• Countdown with timer
    3 replies, posted
Hi. I'm not so much experienced in GLua, but I'm making something for a friend, and I need to know how to make a countdown with a timer. (timer.Simple would be great) I want the countdown to be displayed on a hud (obviously it'll be in a variable). I was thinking of making something like this (with a timer.Create), but I think that this is just a dumb code '-'. [LUA] -- Don't judge this code please ! cdValue = 100 function cdown() cdValue = cdValue - 1 if cdValue == 0 then RunWhatIWantYouToRun-PLEASE end end timer.Create( "cdTimer1", 1, 100, function() cdown() end ) [/LUA] That's the code I wanted to make first... but I'll prefer a timer.Simple. Thanks !
Try using CurTime() [URL="https://wiki.garrysmod.com/page/Global/CurTime"]Here[/URL] is the wiki page. Just checked and it also features a counter
Just create a timer and use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/timer/TimeLeft]timer.TimeLeft[/url]
[QUOTE=iJohnny;51265616]Just create a timer and use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/timer/TimeLeft]timer.TimeLeft[/url][/QUOTE] Thanks for the reply.
Sorry, you need to Log In to post a reply to this thread.