I don't know why this won't toggle, I've been stumped for a few hours now trying to fix it.
Code:
HackName["SpeedHack"] = CreateClientConVar("HackName_SpeedHack", 0, true, false)
TS = GetConVar("host_timescale")
CH = GetConVar("sv_cheats")
local function speedon()
CH:SetValue(1.0)
TS:SetValue(5.0)
end
function speedoff()
TS:SetValue(1.0)
end
if HackName["SpeedHack"] == 0 then
speedoff()
else
speedon()
end
I honestly have no idea why this won't work properly. I can get it to work by doing:
Code:
CH = GetConVar("sv_cheats")
TS = GetConVar("host_timescale")
function speedon()
CH:SetValue(1)
TS:SetValue(5)
end
function speedoff()
TS:SetValue(1)
end
concommand.Add("+HackName_SpeedHack", speedon)
concommand.Add("-HackName_SpeedHack", speedoff)
But doing it this way causes quite a bit of hassle whilst trying to implement it into a menu. Any help at all would be appreciated.