24.08.2009, 08:48
As I aksed in my old topic, is there anyone who can help me how to do an countdown?
forward CountDown();
new CountText[5][5] ={"~r~1","~b~2","~b~3","~g~4","~g~5"};
if (strcmp(cmdtext, "/count", true)==0)
{
if(Count >= 5)
{
new name;
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "SERVER: %s started countdown.", name );
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "[1234] %s started countdown", name );
printf(string);
CountDown();
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "SERVER: Countdown is already started.");
return 1;
}
}
public CountDown(){
if (Count > 0){
GameTextForAll( CountText[Count-1], 2500, 3);
Count--;
SetTimer("CountDown", 1000, 0);
}
else{
GameTextForAll("~r~Go~w~! ~r~Go~w~! ~r~Go~w~!", 2500, 3);
Count = 5;
}
return 1;
}