Best (and safest) way to setup a cooldown mechanic to script?
1 replies, posted
I've got an addon that heals a player, simple as that. The thing is, I don't want players to be able to spam use on the prop that activates the healing.
I'm assuming I'd have to do something with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/os/time]os.time[/url]. Is there any downside to using this?
Use CurTime for best results; something along these lines
[code]
local NextUse = CurTime()
if NextUse <= CurTime() then
NextUse = CurTime() + 2
...
end
[/code]
The number is in seconds, works precise for general use, even going as far as hundredths
Sorry, you need to Log In to post a reply to this thread.