SA-MP Forums Archive
Help with textdraw and countdown.. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with textdraw and countdown.. (/showthread.php?tid=174516)



Help with textdraw and countdown.. - Fedee! - 05.09.2010

Hi, I am trying to make a countdown of 30 seconds, when 0 is reached, that area is yours.

What I need is how to make that countdown, I tryed with GetTickCount but nothing, it just says "65545121" (Example).

Here is part of the script.

pawn Код:
EnteredArea10[i] = 1; // He has entered
SendClientMessage(i,COLOR_CON_GREEN, "Quedate aca 30 segundos para capturar esta area!");
T10[i] = SetTimer("TakeOver",30000,0);
SendClientMessageToAll(COLOR_CON_GREEN, "La ciudad antigua estб siendo capturada!");
TextDrawShowForPlayer(i, trpc);
T10[i] = GetTickCount();
new strtrpc[64];
format(strtrpc, 64, "Tiempo restante para capturar: %d segundos", T10[i]);
TextDrawSetString(trpc, strtrpc);
Thanks!


Re: Help with textdraw and countdown.. - Fedee! - 06.09.2010

Bump! please answer!


Re: Help with textdraw and countdown.. - Mauzen - 06.09.2010

You could set the TakeOver timer time to 1000ms and increase a variable by 1 in there. If it is over 30, you can trigger the normal stuff, and else use the variable for the countdown


Re: Help with textdraw and countdown.. - Fedee! - 06.09.2010

Huh.. so.. I put the timer to 1000ms, then, in the callback, I put a variable, and then? Im lost >.<


Re: Help with textdraw and countdown.. - Mauzen - 06.09.2010

The variable needs to be global (created at the beginning of your script, not in the function) Then in the function you increase it by 1 (variable ++) and check if it is > 30 (if(variable > 30)). If it is, do your TakeOver code. If not, set the TextDrawString to 30 - the variable (so that it is a countdown)


Re: Help with textdraw and countdown.. - Fedee! - 06.09.2010

Quote:
Originally Posted by Zox
Посмотреть сообщение
roflmao dont double post -.-
Thanks noob, read rules first.

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
The variable needs to be global (created at the beginning of your script, not in the function) Then in the function you increase it by 1 (variable ++) and check if it is > 30 (if(variable > 30)). If it is, do your TakeOver code. If not, set the TextDrawString to 30 - the variable (so that it is a countdown)
And, THANK YOU! It worked