24.03.2016, 16:20
PHP код:
GetRandomPlayerInTeam(teamid) {
new
count,
player[MAX_PLAYERS],
i = GetPlayerPoolSize()
;
while(i >= 0) { // set gTeam to an invalid value in OnPlayerDisconnect to
if(gTeam[i] == teamid) { // avoid the additional call to IsPlayerConnected
player[count++] = i;
}
i--;
}
return count ? player[random(count)] : INVALID_PLAYER_ID;
}