02.11.2015, 20:54
Propably it should be something like this
pawn Код:
forward CheckDerby();
public CheckDerby()
{
if(derby_time == false) return 0;
if(winner_derby == true) return 0;
new string[145], Float:_pos[3];
foreach(derby, playerid)
{
if(OnDerby[playerid])
{
GetPlayerPos(playerid, _pos[0], _pos[1], _pos[2]);
switch(mode)
{
case DB_ID:
{
if(_pos[2] < 10.1)
{
format(string, sizeof string, "Eliminated:"white" %s has lost the derby [Fall out of Arena] (%d position)", GetName(playerid), Iter_Count(derby));
SendClientMessageToAll(COLOR_RED, string);
Iter_Remove(derby, playerid);
new specplayer = Iter_Random(derby);
StartSpectate(playerid, specplayer);
OnDerby[playerid] = false;
}
}
}
}
}
if(Iter_Count(derby) < 2)
{
foreach(derby, x)
{
format(string, sizeof string, "Winner:"white" %s has won the Derby, they won 5+ scores, 4 cakes and $2500", GetName(x));
SendClientMessageToAll(COLOR_GREEN, string);
SetPlayerScore(x, GetPlayerScore(x) + 5);
GivePlayerCash(x, 2500);
GiveCake(x, 4);
User[x][accountDerby] ++;
}
winner_derby = true;
SetTimer("ProcessEnding", 3500, false);
KillTimer(timer);
KillTimer(timer2);
}
return 1;
}