Easiest way to coding a count down
#1

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.
Reply
#2

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
Reply
#3

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.
Reply
#4

Edited my post - check again please.
Reply
#5

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.
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)