04.08.2010, 22:31
Why so fkin' many loops?
I don't like the way this your countdown-system works, but tried my best:
It works, or not.
I don't like the way this your countdown-system works, but tried my best:
pawn Код:
forward countdown(playerid);
public countdown(playerid)
{
if(CountDown != -1)
{
new text[32];
if(CountDown == 6) // Countdown starting..
{
format(text, sizeof(text), "~p~Starting...");
CountDown--;
}
else if(CountDown == 0) // Countdown ended..
{
format(text, sizeof(text), "~g~GO ~r~!");
CountDown = -1;
}
else // Countdown in action..
{
format(text, sizeof(text), "~w~%d", CountDown);
CountDown--;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetDistanceBetweenPlayers(playerid, i) < 8.0)
{
if(CountDown == 6) // Countdown starting..
{
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
TogglePlayerControllable(i, false);
}
else if(CountDown == 0) // Countdown ended..
{
PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
TogglePlayerControllable(i, true);
}
GameTextForPlayer(i, text, 1000, 6);
}
}
SetTimerEx("countdown", 1000, false, "i", playerid);
}
return 1;
}