08.08.2011, 18:30
PHP код:
forward CountDown();
new bool: IsCountdownStarted;
new CountdownTimer;
public CountDown()
{
switch(Count)
{
case 5: { GameTextForAll("~b~-~r~ 5 ~b~-", 1100, 3); }
case 4: { GameTextForAll("~b~-~r~ 4 ~b~-", 1100, 3); }
case 3: { GameTextForAll("~b~-~r~ 3 ~b~-", 1100, 3); }
case 2: { GameTextForAll("~b~-~r~ 2 ~b~-", 1100, 3); }
case 1: { GameTextForAll("~b~-~r~ 1 ~b~-", 1100, 3); }
case 0:
{
GameTextForAll("~b~-~g~ go! ~b~-", 2000, 3);
KillTimer(CountdownTimer);
IsCountdownStarted = false;
}
}
Count--;
}
COMMAND:count(playerid, params[]) {
#pragma unused params
if(IsCountdownStarted == false)
{
Count = 5;
CountdownTimer = SetTimer("CountDown", 1000, 1);
IsCountdownStarted = true;
SendClientMessage(playerid, COLOR_ORANGE, "You have started the CountDown!");
new countstring2[128];
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid,PlayerName, MAX_PLAYER_NAME);
format(countstring2, 128, "%s has started the CountDown", PlayerName);
SendClientMessage(COLOR_GREY, countstring2);
}
else
{
SendClientMessage(playerid, COLOR_RED, "The CountDown has already started!");
}
return 1;
}