fix discord presence random error + remove unsued var

This commit is contained in:
Jonny_Bro (Nikita) 2023-09-04 21:52:42 +05:00
parent 62e1d5fdb4
commit 7bb34efc96
45 changed files with 66 additions and 84 deletions

View file

@ -1,4 +1,4 @@
if not util.IsBinaryModuleInstalled("gdiscord", "GAME") then return end if not util.IsBinaryModuleInstalled("gdiscord") then return end
require("gdiscord") require("gdiscord")
@ -8,6 +8,9 @@ local refresh_time = 60
local discord_start = discord_start or -1 local discord_start = discord_start or -1
function DiscordUpdate() function DiscordUpdate()
local ply = LocalPlayer()
if not ply.GetLevel then return end
local rpc_data = {} local rpc_data = {}
if game.SinglePlayer() then if game.SinglePlayer() then
@ -34,14 +37,10 @@ function DiscordUpdate()
rpc_data["partyMax"] = 0 rpc_data["partyMax"] = 0
end end
local level = LocalPlayer():GetLevel() local level = ply:GetLevel()
local customname = hook.Run("BeatrunHUDCourse") local customname = hook.Run("BeatrunHUDCourse")
local course = customname and customname or Course_Name ~= "" and Course_Name or "Freeplay" local course = customname and customname or Course_Name ~= "" and Course_Name or "Freeplay"
if course == nil then
course = "Freeplay"
end
rpc_data["details"] = "Level: " .. level .. " | Map: " .. game.GetMap() rpc_data["details"] = "Level: " .. level .. " | Map: " .. game.GetMap()
rpc_data["startTimestamp"] = discord_start rpc_data["startTimestamp"] = discord_start

View file

@ -1,4 +1,4 @@
if not util.IsBinaryModuleInstalled("steamrichpresencer", "GAME") then return end if not util.IsBinaryModuleInstalled("steamrichpresencer") then return end
require("steamrichpresencer") require("steamrichpresencer")
@ -10,14 +10,9 @@ local function UpdateRichPresence()
if not ply.GetLevel then return end if not ply.GetLevel then return end
local map = game.GetMap() local map = game.GetMap()
local level = LocalPlayer():GetLevel() local level = ply:GetLevel()
local course = nil
local customname = hook.Run("BeatrunHUDCourse") local customname = hook.Run("BeatrunHUDCourse")
course = customname and customname or Course_Name ~= "" and Course_Name or "Freeplay" local course = customname and customname or Course_Name ~= "" and Course_Name or "Freeplay"
if course == nil then
course = "Freeplay"
end
local updatedtext = "Beatrun Lv. " .. level .. " (" .. map .. ") | " .. course local updatedtext = "Beatrun Lv. " .. level .. " (" .. map .. ") | " .. course

View file

@ -3,19 +3,6 @@ local playermeta = FindMetaTable("Player")
CLoadout = {} CLoadout = {}
function CLIENT_IFTP()
return CLIENT and IsFirstTimePredicted()
end
--[[
local matrixdatatmp = {
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 1}
}
]]
local mtmp = { local mtmp = {
{0, 0, 0, 0}, {0, 0, 0, 0},
{0, 0, 0, 0}, {0, 0, 0, 0},

View file

@ -2,6 +2,7 @@ soundAdd_old = sound.Add
local function soundAdd_detour(tbl) local function soundAdd_detour(tbl)
if not tbl.name then return end if not tbl.name then return end
soundAdd_old(tbl) soundAdd_old(tbl)
timer.Simple(2, function() timer.Simple(2, function()

View file

@ -75,7 +75,7 @@ hook.Add("SetupMove", "Balance", function(ply, mv, cmd)
ParkourEvent("walkbalancestill", ply) ParkourEvent("walkbalancestill", ply)
end end
if CLIENT_IFTP() and mv:KeyPressed(IN_ATTACK2) then if CLIENT and IsFirstTimePredicted() and mv:KeyPressed(IN_ATTACK2) then
dircache.y = dircache.y - 180 dircache.y = dircache.y - 180
end end

View file

@ -159,7 +159,7 @@ local function ClimbingThink(ply, mv, cmd)
ParkourEvent("hangend", ply) ParkourEvent("hangend", ply)
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
lockang2 = false lockang2 = false
lockang = false lockang = false
BodyLimitX = 90 BodyLimitX = 90
@ -182,7 +182,7 @@ local function ClimbingThink(ply, mv, cmd)
ply:SetSafetyRollKeyTime(CurTime() + 0.1) ply:SetSafetyRollKeyTime(CurTime() + 0.1)
ParkourEvent("hangjump", ply) ParkourEvent("hangjump", ply)
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
lockang2 = false lockang2 = false
lockang = false lockang = false
BodyLimitX = 90 BodyLimitX = 90
@ -716,7 +716,7 @@ local function ClimbingCheck(ply, mv, cmd)
ply:EmitSound("Handsteps.ConcreteHard") ply:EmitSound("Handsteps.ConcreteHard")
ply:EmitSound("Cloth.RollLand") ply:EmitSound("Cloth.RollLand")
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply.OrigEyeAng = wallang ply.OrigEyeAng = wallang
lockang2 = true lockang2 = true

View file

@ -37,7 +37,7 @@ local function Dive(ply, mv, cmd)
effectdata:SetOrigin(vPoint) effectdata:SetOrigin(vPoint)
util.Effect("WaterSurfaceExplosion", effectdata) util.Effect("WaterSurfaceExplosion", effectdata)
elseif CLIENT_IFTP() then elseif CLIENT and IsFirstTimePredicted() then
local vPoint = mv:GetOrigin() local vPoint = mv:GetOrigin()
local effectdata = EffectData() local effectdata = EffectData()

View file

@ -91,7 +91,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
ply:SetNW2Entity("grappleEntity", trout.Entity) ply:SetNW2Entity("grappleEntity", trout.Entity)
ply:SetNW2Bool("grappledNonCourse", true) ply:SetNW2Bool("grappledNonCourse", true)
if CLIENT_IFTP() or game.SinglePlayer() then if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:EmitSound("MirrorsEdge/Gadgets/ME_Magrope_Fire.wav", 40, 100 + math.random(-25, 10)) ply:EmitSound("MirrorsEdge/Gadgets/ME_Magrope_Fire.wav", 40, 100 + math.random(-25, 10))
end end
@ -131,7 +131,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
ply:SetGrappling(false) ply:SetGrappling(false)
if CLIENT_IFTP() or game.SinglePlayer() then if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:EmitSound("MirrorsEdge/zipline_detach.wav", 40, 100 + math.random(-25, 10)) ply:EmitSound("MirrorsEdge/zipline_detach.wav", 40, 100 + math.random(-25, 10))
end end

View file

@ -36,7 +36,7 @@ local function LadderCheck(ply, mv, cmd, ladder)
ply:SendLua("BodyAnimSetEase(LocalPlayer():GetNW2Vector('SPBAEase'))") ply:SendLua("BodyAnimSetEase(LocalPlayer():GetNW2Vector('SPBAEase'))")
end end
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
local ang = ply:EyeAngles() local ang = ply:EyeAngles()
ang.y = ladder:GetAngles().y - 180 ang.y = ladder:GetAngles().y - 180
ang.x = 0 ang.x = 0
@ -141,7 +141,7 @@ local function LadderThink(ply, mv, cmd, ladder)
elseif ply.LadderDown and ply:GetLadderDelay() < CurTime() then elseif ply.LadderDown and ply:GetLadderDelay() < CurTime() then
ply.LadderDown = false ply.LadderDown = false
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(5, 0, 0)) ply:CLViewPunch(Angle(5, 0, 0))
BodyAnim:SetSequence("ladderclimbuprighthandstill") BodyAnim:SetSequence("ladderclimbuprighthandstill")
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
@ -233,7 +233,7 @@ local function LadderThink(ply, mv, cmd, ladder)
mv:SetOrigin(newpos) mv:SetOrigin(newpos)
mv:SetVelocity(vector_origin) mv:SetVelocity(vector_origin)
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
BodyAnim:SetSequence("jumpfast") BodyAnim:SetSequence("jumpfast")
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:SendLua("BodyAnim:SetSequence('jumpfast')") ply:SendLua("BodyAnim:SetSequence('jumpfast')")

View file

@ -19,7 +19,7 @@ local meleedata = {
}, },
{ {
"meleeslide", 0.175, 0.6, function(ply, mv, cmd) "meleeslide", 0.175, 0.6, function(ply, mv, cmd)
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(0.05, 0, -1)) ply:CLViewPunch(Angle(0.05, 0, -1))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(0.1, 0, -1.5)) ply:ViewPunch(Angle(0.1, 0, -1.5))
@ -29,7 +29,7 @@ local meleedata = {
}, },
{ {
"meleeairstill", 0.1, 1, function(ply, mv, cmd) "meleeairstill", 0.1, 1, function(ply, mv, cmd)
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(0.5, 0, -0.1)) ply:CLViewPunch(Angle(0.5, 0, -0.1))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(1, 0, -0.25)) ply:ViewPunch(Angle(1, 0, -0.25))
@ -39,7 +39,7 @@ local meleedata = {
}, },
{ {
"meleeair", 0.15, 1, function(ply, mv, cmd) "meleeair", 0.15, 1, function(ply, mv, cmd)
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(0.05, 0, -1)) ply:CLViewPunch(Angle(0.05, 0, -1))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(0.1, 0, -1.5)) ply:ViewPunch(Angle(0.1, 0, -1.5))
@ -51,7 +51,7 @@ local meleedata = {
meleedata[5] = { meleedata[5] = {
"meleewrleft", 0.2, 0.75, function(ply, mv, cmd) "meleewrleft", 0.2, 0.75, function(ply, mv, cmd)
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(0.075, 0, 1)) ply:CLViewPunch(Angle(0.075, 0, 1))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(0.1, 0, 1.5)) ply:ViewPunch(Angle(0.1, 0, 1.5))
@ -64,7 +64,7 @@ meleedata[5] = {
mv:SetVelocity(vel) mv:SetVelocity(vel)
if CLIENT_IFTP() or game.SinglePlayer() then if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
local ang = ply:EyeAngles() local ang = ply:EyeAngles()
ang.y = ang.y + (CurTime() - ply:GetMeleeDelay()) / 0.15 * 0.25 ang.y = ang.y + (CurTime() - ply:GetMeleeDelay()) / 0.15 * 0.25
@ -76,7 +76,7 @@ meleedata[5] = {
meleedata[6] = { meleedata[6] = {
"meleewrright", 0.2, 0.75, function(ply, mv, cmd) "meleewrright", 0.2, 0.75, function(ply, mv, cmd)
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(0.075, 0, -1)) ply:CLViewPunch(Angle(0.075, 0, -1))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(0.1, 0, -1.5)) ply:ViewPunch(Angle(0.1, 0, -1.5))
@ -89,7 +89,7 @@ meleedata[6] = {
mv:SetVelocity(vel) mv:SetVelocity(vel)
if CLIENT_IFTP() or game.SinglePlayer() then if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
local ang = ply:EyeAngles() local ang = ply:EyeAngles()
ang.y = ang.y - (CurTime() - ply:GetMeleeDelay()) / 0.15 * 0.25 ang.y = ang.y - (CurTime() - ply:GetMeleeDelay()) / 0.15 * 0.25

View file

@ -29,7 +29,7 @@ hook.Add("PlayerNoClip", "BlockNoClip", function(ply, enabled)
if enabled and Course_Name ~= "" and ply:GetNW2Int("CPNum", 1) ~= -1 then if enabled and Course_Name ~= "" and ply:GetNW2Int("CPNum", 1) ~= -1 then
ply:SetNW2Int("CPNum", -1) ply:SetNW2Int("CPNum", -1)
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
notification.AddLegacy("Noclip Detected! Respawn to restart the course", NOTIFY_ERROR, 4) notification.AddLegacy("Noclip Detected! Respawn to restart the course", NOTIFY_ERROR, 4)
elseif SERVER and game.SinglePlayer() then elseif SERVER and game.SinglePlayer() then
ply:SendLua("notification.AddLegacy(\"Noclip Detected! Respawn to restart the course\", NOTIFY_ERROR, 4)") ply:SendLua("notification.AddLegacy(\"Noclip Detected! Respawn to restart the course\", NOTIFY_ERROR, 4)")

View file

@ -158,7 +158,7 @@ local function SwingbarThink(ply, mv, cmd)
ply:SetSBDelay(CurTime() + 1) ply:SetSBDelay(CurTime() + 1)
if CLIENT_IFTP() or game.SinglePlayer() then if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:EmitSound("Cloth.VaultSwish") ply:EmitSound("Cloth.VaultSwish")
end end

View file

@ -96,7 +96,7 @@ local function Quickturn(ply, mv, cmd)
if not lookahead and not lookbehind and ply:WaterLevel() < 3 and not IsValid(ply:GetSwingbar()) and not IsValid(ply:GetZipline()) then if not lookahead and not lookbehind and ply:WaterLevel() < 3 and not IsValid(ply:GetSwingbar()) and not IsValid(ply:GetZipline()) then
return return
elseif (lookahead or lookbehind) and ply:WaterLevel() < 3 and not IsValid(ply:GetSwingbar()) and not IsValid(ply:GetZipline()) then elseif (lookahead or lookbehind) and ply:WaterLevel() < 3 and not IsValid(ply:GetSwingbar()) and not IsValid(ply:GetZipline()) then
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
DoJumpTurn(lookbehind) DoJumpTurn(lookbehind)
elseif SERVER and game.SinglePlayer() then elseif SERVER and game.SinglePlayer() then
ply:SendLua("DoJumpTurn(" .. tostring(lookbehind) .. ")") ply:SendLua("DoJumpTurn(" .. tostring(lookbehind) .. ")")
@ -212,7 +212,7 @@ local function Quickturn(ply, mv, cmd)
standpunch.z = 0 standpunch.z = 0
end end
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(standpunch) ply:CLViewPunch(standpunch)
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(standpunch) ply:ViewPunch(standpunch)
@ -236,7 +236,7 @@ local function Quickturn(ply, mv, cmd)
target.y = lerp target.y = lerp
if CLIENT_IFTP() or game.SinglePlayer() then if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:SetEyeAngles(target) ply:SetEyeAngles(target)
end end

View file

@ -91,12 +91,12 @@ hook.Add("SetupMove", "EvadeRoll", function(ply, mv, cmd)
if SERVER and not land then if SERVER and not land then
ply:EmitSound("Cloth.Roll") ply:EmitSound("Cloth.Roll")
ply:EmitSound("Cloth.RollLand") ply:EmitSound("Cloth.RollLand")
elseif CLIENT_IFTP() or game.SinglePlayer() then elseif CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:EmitSound("Handsteps.ConcreteHard") ply:EmitSound("Handsteps.ConcreteHard")
ply:EmitSound("Land.Concrete") ply:EmitSound("Land.Concrete")
end end
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
CacheBodyAnim() CacheBodyAnim()
RemoveBodyAnim() RemoveBodyAnim()
StartBodyAnim(roll) StartBodyAnim(roll)
@ -155,12 +155,12 @@ hook.Add("OnPlayerHitGround", "SafetyRoll", function(ply, water, floater, speed)
if SERVER and not land then if SERVER and not land then
ply:EmitSound("Cloth.Roll") ply:EmitSound("Cloth.Roll")
ply:EmitSound("Cloth.RollLand") ply:EmitSound("Cloth.RollLand")
elseif CLIENT_IFTP() or game.SinglePlayer() then elseif CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:EmitSound("Handsteps.ConcreteHard") ply:EmitSound("Handsteps.ConcreteHard")
ply:EmitSound("Land.Concrete") ply:EmitSound("Land.Concrete")
end end
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
CacheBodyAnim() CacheBodyAnim()
RemoveBodyAnim() RemoveBodyAnim()
StartBodyAnim(roll) StartBodyAnim(roll)

View file

@ -2,13 +2,13 @@ local qslide_duration = 3
local qslide_speedmult = 1 local qslide_speedmult = 1
local slide_sounds = { local slide_sounds = {
[MAT_DIRT] = {"datae/fol_slide_dirt_01.wav", "datae/fol_slide_dirt_02.wav", "datae/fol_slide_dirt_03.wav", "datae/fol_slide_dirt_04.wav"}, [MAT_DIRT] = {"fol/fol_slide_dirt_01.wav", "fol/fol_slide_dirt_02.wav", "fol/fol_slide_dirt_03.wav", "fol/fol_slide_dirt_04.wav"},
[MAT_SAND] = {"datae/fol_slide_sand_01.wav", "datae/fol_slide_sand_02.wav", "datae/fol_slide_sand_03.wav", "datae/fol_slide_sand_04.wav"}, [MAT_SAND] = {"fol/fol_slide_sand_01.wav", "fol/fol_slide_sand_02.wav", "fol/fol_slide_sand_03.wav", "fol/fol_slide_sand_04.wav"},
[MAT_METAL] = {"datae/fol_slide_metal_01.wav", "datae/fol_slide_metal_02.wav", "datae/fol_slide_metal_03.wav"}, [MAT_METAL] = {"fol/fol_slide_metal_01.wav", "fol/fol_slide_metal_02.wav", "fol/fol_slide_metal_03.wav"},
[MAT_GLASS] = {"datae/fol_slide_glass_01.wav", "datae/fol_slide_glass_02.wav", "datae/fol_slide_glass_03.wav", "datae/fol_slide_glass_04.wav"}, [MAT_GLASS] = {"fol/fol_slide_glass_01.wav", "fol/fol_slide_glass_02.wav", "fol/fol_slide_glass_03.wav", "fol/fol_slide_glass_04.wav"},
[MAT_GRATE] = {"datae/fol_slide_grate_01.wav"}, [MAT_GRATE] = {"fol/fol_slide_grate_01.wav"},
[MAT_SLOSH] = {"ambient/water/water_splash1.wav", "ambient/water/water_splash2.wav", "ambient/water/water_splash3.wav"}, [MAT_SLOSH] = {"ambient/water/water_splash1.wav", "ambient/water/water_splash2.wav", "ambient/water/water_splash3.wav"},
[MAT_WOOD] = {"datae/fol_slide_generic_01.wav", "datae/fol_slide_generic_02.wav", "datae/fol_slide_generic_03.wav"} [MAT_WOOD] = {"fol/fol_slide_generic_01.wav", "fol/fol_slide_generic_02.wav", "fol/fol_slide_generic_03.wav"}
} }
local slideloop_sounds = { local slideloop_sounds = {
@ -430,7 +430,7 @@ hook.Add("SetupMove", "qslide", function(ply, mv, cmd)
net.Send(ply) net.Send(ply)
end end
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
SlidingAnimStart() SlidingAnimStart()
hook.Add("Think", "SlidingAnimThink", SlidingAnimThink) hook.Add("Think", "SlidingAnimThink", SlidingAnimThink)
@ -480,7 +480,7 @@ hook.Add("SetupMove", "qslide", function(ply, mv, cmd)
net.Send(ply) net.Send(ply)
ply.DiveSliding = false ply.DiveSliding = false
elseif CLIENT_IFTP() then elseif CLIENT and IsFirstTimePredicted() then
SlidingAnimEnd(false, ply.DiveSliding) SlidingAnimEnd(false, ply.DiveSliding)
ply.DiveSliding = false ply.DiveSliding = false
@ -623,7 +623,7 @@ hook.Add("SetupMove", "qslide", function(ply, mv, cmd)
net.WriteBool(slippery) net.WriteBool(slippery)
net.WriteBool(ply.DiveSliding) net.WriteBool(ply.DiveSliding)
net.Send(ply) net.Send(ply)
elseif CLIENT_IFTP() then elseif CLIENT and IsFirstTimePredicted() then
SlidingAnimEnd(slippery, ply.DiveSliding) SlidingAnimEnd(slippery, ply.DiveSliding)
end end

View file

@ -162,7 +162,7 @@ local function SwingpipeThink(ply, mv, cmd)
if CLIENT or game.SinglePlayer() then if CLIENT or game.SinglePlayer() then
ply:SetEyeAngles(LerpAngle(startlerp, ply:EyeAngles(), circlepos:Angle())) ply:SetEyeAngles(LerpAngle(startlerp, ply:EyeAngles(), circlepos:Angle()))
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
viewtiltlerp.z = startlerp * -10 * dir viewtiltlerp.z = startlerp * -10 * dir
ply:CLViewPunch(Angle(0, 0.1 * dir)) ply:CLViewPunch(Angle(0, 0.1 * dir))

View file

@ -231,7 +231,7 @@ local function Vault2(ply, mv, ang, t, h)
local hulltr2 = util.TraceHull(h) local hulltr2 = util.TraceHull(h)
if not hulltr.Hit and not hulltr2.Hit then if not hulltr.Hit and not hulltr2.Hit then
if t.MatType == MAT_GRATE and (CLIENT_IFTP() or game.SinglePlayer()) then if t.MatType == MAT_GRATE and (CLIENT and IsFirstTimePredicted() or game.SinglePlayer()) then
ply:EmitSound("FenceClimb") ply:EmitSound("FenceClimb")
end end
@ -331,7 +331,7 @@ local function Vault3(ply, mv, ang, t, h)
local hulltr2 = util.TraceHull(h) local hulltr2 = util.TraceHull(h)
if not hulltr.Hit and not hulltr2.Hit then if not hulltr.Hit and not hulltr2.Hit then
if t.MatType == MAT_GRATE and (CLIENT_IFTP() or game.SinglePlayer()) then if t.MatType == MAT_GRATE and (CLIENT and IsFirstTimePredicted() or game.SinglePlayer()) then
ply:EmitSound("FenceClimb") ply:EmitSound("FenceClimb")
end end
@ -596,7 +596,7 @@ hook.Add("SetupMove", "BeatrunVaulting", function(ply, mv, cmd)
if not ply.VaultStepUp and mlerp > 0.01 and mlerp < 0.65 then if not ply.VaultStepUp and mlerp > 0.01 and mlerp < 0.65 then
mlerprate = mlerprate * mlerp / 0.5 mlerprate = mlerprate * mlerp / 0.5
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(0.1 / (mlerp / 0.25), 0, 0.05)) ply:CLViewPunch(Angle(0.1 / (mlerp / 0.25), 0, 0.05))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(0.33 / (mlerp / 0.25), 0, 0.05)) ply:ViewPunch(Angle(0.33 / (mlerp / 0.25), 0, 0.05))
@ -617,13 +617,13 @@ hook.Add("SetupMove", "BeatrunVaulting", function(ply, mv, cmd)
mlerprate = mlerprate * mult mlerprate = mlerprate * mult
end end
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(0.25 * mlerp / 0.2, -0.05, -0.15)) ply:CLViewPunch(Angle(0.25 * mlerp / 0.2, -0.05, -0.15))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(0.75 * mlerp / 0.2, -0.25, -0.5)) ply:ViewPunch(Angle(0.75 * mlerp / 0.2, -0.25, -0.5))
end end
elseif mlerp > 0.45 and mlerp < 0.7 then elseif mlerp > 0.45 and mlerp < 0.7 then
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(-0.15, 0.1, 0.15)) ply:CLViewPunch(Angle(-0.15, 0.1, 0.15))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(-0.75, 0.25, 0.5)) ply:ViewPunch(Angle(-0.75, 0.25, 0.5))
@ -633,13 +633,13 @@ hook.Add("SetupMove", "BeatrunVaulting", function(ply, mv, cmd)
ply:SetMantleLerp(math.Approach(mlerp, 1, mlerprate)) ply:SetMantleLerp(math.Approach(mlerp, 1, mlerprate))
elseif mantletype == 3 then elseif mantletype == 3 then
if mlerp < 0.45 then if mlerp < 0.45 then
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(0.15, 0, 0)) ply:CLViewPunch(Angle(0.15, 0, 0))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(0.3, 0, 0)) ply:ViewPunch(Angle(0.3, 0, 0))
end end
elseif mlerp > 0.45 and mlerp < 0.8 then elseif mlerp > 0.45 and mlerp < 0.8 then
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(-0.05, 0, 0)) ply:CLViewPunch(Angle(-0.05, 0, 0))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(-0.25, 0, 0)) ply:ViewPunch(Angle(-0.25, 0, 0))
@ -655,14 +655,14 @@ hook.Add("SetupMove", "BeatrunVaulting", function(ply, mv, cmd)
mlerprate = 0.03 / TargetTick mlerprate = 0.03 / TargetTick
if mlerp < 0.0575 then if mlerp < 0.0575 then
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(0.25 * mlerp / 0.2, 0, -0.25)) ply:CLViewPunch(Angle(0.25 * mlerp / 0.2, 0, -0.25))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(0.75 * mlerp / 0.1, 0, -0.5)) ply:ViewPunch(Angle(0.75 * mlerp / 0.1, 0, -0.5))
end end
mlerprate = mlerprate * 0.1 mlerprate = mlerprate * 0.1
elseif CLIENT_IFTP() then elseif CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(-0.05, 0, 0.25 / (mlerp / 0.3))) ply:CLViewPunch(Angle(-0.05, 0, 0.25 / (mlerp / 0.3)))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(-0.15, 0, 0.5 / (mlerp / 0.3))) ply:ViewPunch(Angle(-0.15, 0, 0.5 / (mlerp / 0.3)))
@ -677,7 +677,7 @@ hook.Add("SetupMove", "BeatrunVaulting", function(ply, mv, cmd)
mlerprate = 0.03 / TargetTick mlerprate = 0.03 / TargetTick
if mlerp < 0.0575 then if mlerp < 0.0575 then
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(-0.15 * mlerp / 0.1, 0, -0.25)) ply:CLViewPunch(Angle(-0.15 * mlerp / 0.1, 0, -0.25))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(0.15 * mlerp / 0.1, 0, -0.5)) ply:ViewPunch(Angle(0.15 * mlerp / 0.1, 0, -0.5))
@ -685,7 +685,7 @@ hook.Add("SetupMove", "BeatrunVaulting", function(ply, mv, cmd)
mlerprate = mlerprate * 0.1 mlerprate = mlerprate * 0.1
else else
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
ply:CLViewPunch(Angle(0.01, 0, 0.5 / (mlerp / 0.15))) ply:CLViewPunch(Angle(0.01, 0, 0.5 / (mlerp / 0.15)))
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:ViewPunch(Angle(-0.05, 0, 0.5 / (mlerp / 0.3))) ply:ViewPunch(Angle(-0.05, 0, 0.5 / (mlerp / 0.3)))
@ -734,7 +734,7 @@ hook.Add("SetupMove", "BeatrunVaulting", function(ply, mv, cmd)
end end
if mv:KeyDown(IN_JUMP) and mantletype < 4 then if mv:KeyDown(IN_JUMP) and mantletype < 4 then
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
BodyLimitX = 90 BodyLimitX = 90
BodyLimitY = 180 BodyLimitY = 180
elseif game.SinglePlayer() then elseif game.SinglePlayer() then

View file

@ -423,7 +423,7 @@ local function WallrunningCheck(ply, mv, cmd)
ParkourEvent("wallrunv", ply) ParkourEvent("wallrunv", ply)
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
BodyLimitX = 30 BodyLimitX = 30
BodyLimitY = 70 BodyLimitY = 70
BodyAnimCycle = 0 BodyAnimCycle = 0

View file

@ -70,7 +70,7 @@ function PuristWallrunningCheck(ply, mv, cmd, vel, eyeang, timemult, speedmult)
ParkourEvent("wallrunv", ply) ParkourEvent("wallrunv", ply)
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
BodyLimitX = 30 BodyLimitX = 30
BodyLimitY = 70 BodyLimitY = 70
BodyAnimCycle = 0 BodyAnimCycle = 0

View file

@ -104,7 +104,7 @@ local function ZiplineCheck(ply, mv, cmd, zipline)
ply:SetZiplineSpeed(math.min(vel:Length(), 750)) ply:SetZiplineSpeed(math.min(vel:Length(), 750))
ply:SetCrouchJumpBlocked(false) ply:SetCrouchJumpBlocked(false)
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
-- local zipline = ply:GetZipline() -- local zipline = ply:GetZipline()
ply.OrigEyeAng = (endpos - startpos):Angle() ply.OrigEyeAng = (endpos - startpos):Angle()
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
@ -113,7 +113,7 @@ local function ZiplineCheck(ply, mv, cmd, zipline)
net.Send(ply) net.Send(ply)
end end
if CLIENT_IFTP() or game.SinglePlayer() then if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:EmitSound("ZiplineLoop") ply:EmitSound("ZiplineLoop")
ply:EmitSound("ZiplineStart") ply:EmitSound("ZiplineStart")
end end
@ -149,7 +149,7 @@ local function ZiplineThink(ply, mv, cmd, zipline)
ply:SetZiplineDelay(CurTime() + 0.75) ply:SetZiplineDelay(CurTime() + 0.75)
if CLIENT_IFTP() or game.SinglePlayer() then if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:EmitSound("ZiplineEnd") ply:EmitSound("ZiplineEnd")
ply:StopSound("ZiplineLoop") ply:StopSound("ZiplineLoop")
@ -189,7 +189,7 @@ local function ZiplineThink(ply, mv, cmd, zipline)
ply:SetZiplineDelay(CurTime() + 0.75) ply:SetZiplineDelay(CurTime() + 0.75)
if CLIENT_IFTP() or game.SinglePlayer() then if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:EmitSound("ZiplineEnd") ply:EmitSound("ZiplineEnd")
ply:StopSound("ZiplineLoop") ply:StopSound("ZiplineLoop")

View file

@ -128,7 +128,7 @@ hook.Add("PlayerFootstep", "MEStepSound", function(ply, pos, foot, sound, volume
ply:EmitSound("Footsteps.Spark") ply:EmitSound("Footsteps.Spark")
end end
if (CLIENT_IFTP() or game.SinglePlayer()) and ply.FootstepLand then if (CLIENT and IsFirstTimePredicted() or game.SinglePlayer()) and ply.FootstepLand then
local landsound = FOOTSTEPS_LAND_LUT[mat] or "Concrete" local landsound = FOOTSTEPS_LAND_LUT[mat] or "Concrete"
ply:EmitSound("Land." .. landsound) ply:EmitSound("Land." .. landsound)
@ -157,7 +157,7 @@ hook.Add("OnPlayerHitGround", "MELandSound", function(ply, water, floater, speed
ParkourEvent("land", ply) ParkourEvent("land", ply)
if ply:GetMelee() == MELEE_DROPKICK and ply:GetMeleeTime() < CurTime() and vel:Length() < 300 then if ply:GetMelee() == MELEE_DROPKICK and ply:GetMeleeTime() < CurTime() and vel:Length() < 300 then
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
Hardland(false) Hardland(false)
elseif SERVER and game.SinglePlayer() then elseif SERVER and game.SinglePlayer() then
net.Start("Beatrun_HardLand") net.Start("Beatrun_HardLand")
@ -185,7 +185,7 @@ hook.Add("OnPlayerHitGround", "MELandSound", function(ply, water, floater, speed
ply:SetJumpTurn(true) ply:SetJumpTurn(true)
end end
if CLIENT_IFTP() then if CLIENT and IsFirstTimePredicted() then
Hardland(jt) Hardland(jt)
elseif SERVER and game.SinglePlayer() then elseif SERVER and game.SinglePlayer() then
net.Start("Beatrun_HardLand") net.Start("Beatrun_HardLand")