Help with time.
I am trying to make a purge system, so when an Admin presses the purge button this is executed. I am new to the time stuff as well as a frame so I am not sure if I am doing this correctly. I don't get any errors when I press the button but nothing happens either. here is the function executed after the button is pressed. If you could help me I would much appreciate it!
function activatepurge()
local time = 600 -- in secconds
if time == 0 then
table.RemoveByValue(activatepurge)
end
draw.RoundedBox(0,100,100,ScrW() * 0.1, ScrH() * 0.1, Color(0,0,0,150))
end
the variable time is at 600 and is a constant. In order for the value to change you need to subtract from it. To do this you can use CurTime() since that is called every frame.
See this link for more information: https://wiki.facepunch.com/gmod/Delays_and_Cooldowns