Adding toggleable things.

So how would someone go about doing something like:
[lua]function SWEP:Think()
if self.Owner:KeyPressed(IN_RELOAD) then
RunConsoleCommand(“host_timescale”, “0.2”)
[/lua]

And making it so that the second time I press the reload key, it goes back to 1?
Also, can you not just give me the code and instead hint at how to do it.
P.S. I have no idea on datatables, USMGs, or NWBools.

There are allot of ways to do that… The easiest would be to check if the “host_timescale” is not 0.[LUA]function SWEP:Think()
if self.Owner:KeyPressed(IN_RELOAD) then
if GetConVarNumber(“host_timescale”) == 0.2 then
RunConsoleCommand(“host_timescale”, “1”)
else
RunConsoleCommand(“host_timescale”, “0.2”)
end
end
end[/LUA]Untested, but should work. Also, stop asking other people to do your work.

:colbert:

Well I think that you should’ve left it at if host_timescale aint 0. But thanks anyways.

[editline]06:02PM[/editline]

Ninja’d :ninja:

I read it wrong to:tinfoil:

That’s what I read the first time.

I kinda feel a little bit bad about flaming at the guy cause of my bad reading. :confused: