13.09.2018, 01:13
That is, I must use three times "for (new i = 0, j = GetPlayerPoolSize (); i <= j; i ++)"?
Please, I need a quick help.
PHP код:
public DerbyCountdown()
{
if(DI[STATUS] != DERBY_WAIT) return KillTimer(DI[COUNTDOWN_TIMER]);
if(DI[PLAYERS] <= 0) return CloseDerby();
if(DI[PLAYERS] == 1)
{
DI[COUNTDOWN_COUNTER] = DERBY_TIME_COUNTDOWN + 1;
for(new playerid = 0, j = GetPlayerPoolSize(); playerid <= j; playerid++)
{
if(IsPlayerConnected(playerid))
{
if(Player[playerid][Mode] == GAME_DERBY)
{
GameTextForPlayer(playerid, "~g~Waiting for players", 500, 3);
}
}
}
return 1;
}
DI[COUNTDOWN_COUNTER] --;
for(new playerid = 0, j = GetPlayerPoolSize(); playerid <= j; playerid++)
{
if(IsPlayerConnected(playerid))
{
if(Player[playerid][Mode] == GAME_DERBY)
{
new str[10]; format(str, 10, "~r~%d_minutes_to_start", DI[COUNTDOWN_COUNTER]);
GameTextForPlayer(playerid, str, 1000, 3);
}
}
}
if(DI[COUNTDOWN_COUNTER] <= 0)
{
KillTimer(DI[COUNTDOWN_TIMER]);
if(DI[PLAYERS] == 0) return CloseDerby();
else if(DI[PLAYERS] == 1)
{
for(new playerid = 0, j = GetPlayerPoolSize(); playerid <= j; playerid++)
{
if(IsPlayerConnected(playerid))
{
if(Player[playerid][Mode] == GAME_DERBY)
{
GameTextForPlayer(playerid, "~g~Waiting for players", 500, 3);
}
}
}
DI[COUNTDOWN_COUNTER] = DERBY_TIME_COUNTDOWN + 1;
KillTimer(DI[COUNTDOWN_TIMER]);
DI[COUNTDOWN_TIMER] = SetTimer("DerbyCountdown", 900, true);
}
else StartDerby();
}
return 1;
}