17.08.2011, 12:51
I am going to explain it a little bit
On top of your script, pretty basic - add
Now we gotta add the timer you need for the countdown. Add this in the area command
It will set a Timer to run. We repeat it all the time till it gets killed. The "i" is defining the playerid (else only playerid 0 will be called)
Now we need to create the public function
If you wonder why I set it to if(countdowntime >= 1). Well, we gotta end it at 0 right? At 0 it will kill the timer.
You can try and see if it works. If it doesn't or you get errors/warnings, please post them
On top of your script, pretty basic - add
pawn Код:
forward countdown(playerid, seconds);
new countdowntime, tCountdown;
pawn Код:
countdowntime = 3;
tCountdown = SetTimerEx("countdown", 1000, true, "i", playerid);
Now we need to create the public function
pawn Код:
public countdown(playerid, seconds)
{
if(countdowntime >= 1)
{
countdowntime --;
format(string, sizeof string, "%i", countdowntime);
GameTextForPlayer(playerid, string, 1000, 4);
}
else
{
GameTextForPlayer(playerid, "0", 1000, 4);
KillTimer(tCountdown);
countdowntime = 3;
}
return 1;
}
You can try and see if it works. If it doesn't or you get errors/warnings, please post them