Easiest way to coding a count down - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Easiest way to coding a count down (
/showthread.php?tid=447585)
Easiest way to coding a count down - Nicholas. - 30.06.2013
What is the easiest way to coding a smooth count down? For example, player connects to server it says "server loading in 10 seconds" and it count backwards. (Usage of either GameTextForPlayer or TextDrawSetString)
I have tried coding it using SetTimerEx but it isn't smooth nor doing exactly what I want it to do. Any help would be appreciated.
Re: Easiest way to coding a count down -
MP2 - 30.06.2013
Faking a server 'loading' is just stupid. Why would you want to 'fake' loading..?
Here's something. I made it in a rush, but it should work.
http://pastebin.com/GBuCApWG
Re: Easiest way to coding a count down - Nicholas. - 30.06.2013
That is not what I am trying to exactly do. There is a textdraw interface with rules etc. I want to show for 10 seconds or more before it goes to the login or register dialogs. I just want something saying X amount of time before whatever.
EDIT:
Alright, Thank you for your code. I will try to learn from it.
Re: Easiest way to coding a count down -
MP2 - 30.06.2013
Edited my post - check again please.
Re: Easiest way to coding a count down -
Pottus - 30.06.2013
MP2 you forgot something, you need to kill the timer when a player disconnects so a player connecting quickly doesn't get stuck with a repeating ghost timer you could also put KillTimer() in the countdown start stock which is probably easier.
Re: Easiest way to coding a count down -
MP2 - 30.06.2013
It wasn't really a proper example, it's a server-wide countdown, not player-specific. For that you'll need SetTimerEx and an array for the timer ID/seconds.