Whenever I start up Gmod I get this error; [lua\autorun\climb_skill_v2.lua:8] attempt to call global 'CLIENT' (a boolean value). Is there any way I can fix this/ any suggestions you can give me?
if CLIENT then ... code end // returns true if client false if SERVER
Show us the whole of the lua code in that file
Ok heres the entire lua file;
CreateConVar( "Climb_MaxLevel", 20, { FCVAR_REPLICATED, FCVAR_ARCHIVE } )
CreateConVar( "Climb_ExpGainDivider", 10, { FCVAR_REPLICATED, FCVAR_ARCHIVE } )
CreateConVar( "Climb_SpeedDivider", 5, { FCVAR_REPLICATED, FCVAR_ARCHIVE } )
CreateConVar( "Climb_ForceByLevelMul", 10, { FCVAR_REPLICATED, FCVAR_ARCHIVE } )
CreateConVar( "Climb_MinForceAdd", 60, { FCVAR_REPLICATED, FCVAR_ARCHIVE } )
CreateConVar( "Climb_MaxForceAdd", 100, { FCVAR_REPLICATED, FCVAR_ARCHIVE } )
if CLIENT() then
local sound
local canfallsound
local maxvel
function FallBlur()
local ply = LocalPlayer()
if ply:GetMoveType() == MOVETYPE_NOCLIP and ply:InVehicle() and ply:GetViewEntity() != ply then return end
if ply:GetNetworkedEntity("RagdollPlayer"):IsValid() then
vel = ply:GetNetworkedEntity("RagdollPlayer"):GetVelocity():Length()
else
vel = ply:GetVelocity():Length()
end
if ply.ImOnGround == false then
maxvel = 300
else
maxvel = 420
end
if vel > maxvel then
if !sound then
sound = CreateSound(ply, "vehicles/fast_windloop1.wav")
sound:Play()
sound:ChangeVolume(0)
end
canfallsound = true
DrawMotionBlur(1-math.Clamp(vel/1000,0,0.9), math.Clamp(vel/500,0,1), 0.01)
else
canfallsound = false
end
if sound then
if canfallsound == true then
sound:ChangeVolume(math.Clamp(vel/1000, 0, 1))
sound:ChangePitch(math.Clamp(vel/10, 0, 200))
else
sound:ChangeVolume(0)
end
end
end
hook.Add("RenderScreenspaceEffects", "FallBlur", FallBlur)
end
if (SERVER) then
local CanLastVel2 = false
local NextExp = CurTime()
local function DoWallJump(ply, key)
if (ply:Alive() and key == IN_JUMP and ply:WaterLevel() <= 1 and !ply:InVehicle() ) then
local pos = ply:GetShootPos();
local up = ply:GetUp();
local left = (ply:GetRight() * -1);
local right = ply:GetRight();
local forward = ply:GetForward();
local back = (ply:GetForward() * -1);
local MinDamage = (ply:GetNWInt("ClimbLevel") + 5)
local MaxDamage = (ply:GetNWInt("ClimbLevel") + 10)
local MinForcevalue = (ply:GetNWInt("ClimbLevel") * GetConVarNumber("Climb_ForceByLevelMul")) + GetConVarNumber("Climb_MinForceAdd")
local MaxForcevalue = (ply:GetNWInt("ClimbLevel") * GetConVarNumber("Climb_ForceByLevelMul")) + GetConVarNumber("Climb_MaxForceAdd")
local upforce = (up * (math.random(MinForcevalue, MaxForcevalue) + ply:GetVelocity():Length() / GetConVarNumber("Climb_SpeedDivider")))
ply.MaxClimbCombo = (math.Round(ply:GetNWInt("ClimbLevel")) / 2) + 3
if ply.ImOnGround == false then
ply.PushForce = (math.random(MinForcevalue, MaxForcevalue) + ((ply:GetVelocity():Length() * 2) / GetConVarNumber("Climb_SpeedDivider")))
else
ply.PushForce = (math.random(MinForcevalue, MaxForcevalue) + ((ply:GetVelocity():Length() / 5) / GetConVarNumber("Climb_SpeedDivider")))
end
ply:SetNWInt("ClimbPushForce", ply.PushForce)
if ply.WalljumpCombo >= ply.MaxClimbCombo then return end
if (ply:KeyDown(IN_FORWARD)) then
local tr = util.QuickTrace(pos, (back * 60), ply);
if (tr.Hit) then
ply:ViewPunch(Angle(10, 0, 0));
local WallFireFix = tr.Entity
WallJumpSound(ply)
util.BlastDamage(ply, ply, tr.HitPos, 4, math.random( MinDamage, MaxDamage ) )
if tr.Entity == WallFireFix and WallFireFix:IsOnFire() then
tr.Entity:Extinguish()
end
ply:SetLocalVelocity((forward * ply.PushForce) + upforce);
if ply.ImOnGround == false and NextExp < CurTime() then
ply:SetNWInt("ClimbExp",math.Clamp(ply:GetNWInt("ClimbExp") + math.Round( GetConVarNumber("Climb_ExpGainDivider") / ply:GetNWInt("ClimbLevel") ), 0, 100) )
file.Write("ClimbSkill/stats/Exp_"..ply:UniqueID()..".txt", ply:GetNWInt("ClimbExp"))
NextExp = CurTime() + 0.5
end
end
end
if (ply:KeyDown(IN_BACK)) then
local tr = util.QuickTrace(pos, (forward * 60), ply);
if (tr.Hit) then
ply:ViewPunch(Angle(10, 0, 0));
local WallFireFix = tr.Entity
WallJumpSound(ply)
util.BlastDamage(ply, ply, tr.HitPos, 4, math.random( MinDamage, MaxDamage ) )
if tr.Entity == WallFireFix and WallFireFix:IsOnFire() then
tr.Entity:Extinguish()
end
ply:SetLocalVelocity((back * ply.PushForce) + upforce);
if ply.ImOnGround == false and NextExp < CurTime() then
ply:SetNWInt("ClimbExp",math.Clamp(ply:GetNWInt("ClimbExp") + math.Round( GetConVarNumber("Climb_ExpGainDivider") / ply:GetNWInt("ClimbLevel") ), 0, 100) )
file.Write("ClimbSkill/stats/Exp_"..ply:UniqueID()..".txt", ply:GetNWInt("ClimbExp"))
NextExp = CurTime() + 0.5
end
end
end
if (ply:KeyDown(IN_MOVELEFT)) then
local tr = util.QuickTrace(pos, (right * 60), ply);
if (tr.Hit) then
local WallFireFix = tr.Entity
WallJumpSound(ply)
util.BlastDamage(ply, ply, tr.HitPos, 4, math.random( MinDamage, MaxDamage ) )
if tr.Entity == WallFireFix and WallFireFix:IsOnFire() then
tr.Entity:Extinguish()
end
if ply:KeyDown(IN_FORWARD) then
ply:SetLocalVelocity(((left * ply.PushForce) + upforce) + (forward * ply.PushForce));
ply:ViewPunch(Angle(10, -10, 0));
elseif !ply:KeyDown(IN_FORWARD) then
ply:SetLocalVelocity(((left * ply.PushForce) + upforce));
ply:ViewPunch(Angle(0, -10, 0));
end
if ply.ImOnGround == false and NextExp < CurTime() then
ply:SetNWInt("ClimbExp",math.Clamp(ply:GetNWInt("ClimbExp") + math.Round( GetConVarNumber("Climb_ExpGainDivider") / ply:GetNWInt("ClimbLevel") ), 0, 100) )
file.Write("ClimbSkill/stats/Exp_"..ply:UniqueID()..".txt", ply:GetNWInt("ClimbExp"))
NextExp = CurTime() + 0.5
end
end
end
if (ply:KeyDown(IN_MOVERIGHT)) then
local tr = util.QuickTrace(pos, (left * 60), ply);
if (tr.Hit) then
local WallFireFix = tr.Entity
WallJumpSound(ply)
util.BlastDamage(ply, ply, tr.HitPos, 4, math.random( MinDamage, MaxDamage ) )
if tr.Entity == WallFireFix and WallFireFix:IsOnFire() then
tr.Entity:Extinguish()
end
if ply:KeyDown(IN_FORWARD) then
ply:SetLocalVelocity(((right * ply.PushForce) + upforce) + (forward * ply.PushForce));
ply:ViewPunch(Angle(10, 10, 0));
elseif !ply:KeyDown(IN_FORWARD) then
ply:SetLocalVelocity(((right * ply.PushForce) + upforce));
ply:ViewPunch(Angle(0, 10, 0));
end
if ply.ImOnGround == false and NextExp < CurTime() then
ply:SetNWInt("ClimbExp",math.Clamp(ply:GetNWInt("ClimbExp") + math.Round( GetConVarNumber("Climb_ExpGainDivider") / ply:GetNWInt("ClimbLevel") ), 0, 100) )
file.Write("ClimbSkill/stats/Exp_"..ply:UniqueID()..".txt", ply:GetNWInt("ClimbExp"))
NextExp = CurTime() + 0.5
end
end
end
end
end
hook.Add("KeyPress", "DoWallJump", DoWallJump);
end
local LastVel = 0
local CanLastVel = false
local CanHangTime = CurTime()
local deployed = true
local holstered = false
local NextLevel = CurTime()
local LevelUpSound = {
Sound("vo/npc/male01/fantastic01.wav"),
Sound("vo/npc/male01/fantastic02.wav"),
Sound("vo/npc/male01/gotone01.wav"),
Sound("vo/npc/male01/gotone02.wav"),
Sound("vo/npc/male01/nice.wav"),
Sound("vo/npc/male01/yeah02.wav") }
local printed = false
function ClimbThink()
for k, v in pairs(player.GetAll()) do
local pos = v:GetShootPos();
local forward = v:GetForward();
local up = v:GetUp();
if not v.Hanging and v:KeyDown(IN_USE) and GrabLedge(v) then
v:SetMoveType(MOVETYPE_NONE)
v.Hanging = true
if deployed == true then
deployed = false
v:GetViewModel():SetNoDraw(true)
if v.ImOnGround == false then
v:SetNWInt("ClimbExp",math.Clamp(v:GetNWInt("ClimbExp") + math.Round( GetConVarNumber("Climb_ExpGainDivider") / v:GetNWInt("ClimbLevel") ), 0, 100) )
file.Write("ClimbSkill/stats/Exp_"..v:UniqueID()..".txt", v:GetNWInt("ClimbExp"))
end
end
end
if deployed == false and v:Alive() then
v:GetActiveWeapon():SetNextPrimaryFire(CurTime() + 0.1)
end
if v.Hanging and v:KeyDown(IN_JUM
remove the () on CLIENT() :p
if CLIENT() then
to
if CLIENT then
Thank you I needed that a lot.
Sorry, you need to Log In to post a reply to this thread.