26.01.2013, 21:02
pawn Code:
stock BalanceEx(Team1, Team2, const Players = MAX_PLAYERS){
static
Interador,
Bloco[2],
MaxP
;
for(Interador = 0, MaxP = Players; Interador != MaxP; ++Interador){
if(IsPlayerConnected(Interador)){
Bloco[0] ++;
}
}
MaxP = Bloco[0] + 1;
if(MaxP % 2){
Bloco[0] = (MaxP / 2);
}else{
Bloco[0] = (MaxP - 1) / 2;
}
Bloco[1] = (MaxP - Bloco[0]);
for(Interador = 0; Interador != (MaxP - 1); ++Interador)
{
Times[Interador] = (Interador <= Bloco[0] ? Team1 : Team2);
}
return true;
}