03.03.2012, 02:56
I'm trying to make a timer, so at the end of.. let's stay, 5 minutes a new map appears, and the game starts. I'd like some text that counts down from 300 seconds. How would I go, to make this possible?
forward CountDown(playerid, seconds);
public CountDown(playerid, seconds)
{
new string[50];
if(seconds > 0)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1056, X, Y, Z);
format(string, sizeof(string), "~R~%d", seconds);
GameTextForPlayer(playerid, string, 1000, 3);
seconds = seconds -1;
SetTimerEx("CountDown", 1000, 0, "ii", playerid, seconds);
return 1;
}
if(seconds == 0)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1057, X, Y, Z);
TogglePlayerControllable(playerid, 1);
return 1;
}
return 1;
}