20.11.2010, 09:27
pawn Код:
new NonZombieCount;
#define MIN_NONZOMBIES 3
foreach( Player, i )
{
if( PlayerTeam[i] != ZOMBIE_TEAM ) NonZombieCount++;
if( NonZombieCount >= MIN_NONZOMBIES ) break;
}
if( NonZombieCount >= MIN_NONZOMBIES )
{
new PlayersAssigned, pID;
do{
pID = Iter_Random(Player);
if( PlayerTeam[pID] == ZOMBIE_TEAM )
{
PlayerTeam[pID] = HUMAN_TEAM;
PlayersAssigned++;
}
}
while( PlayersAssigned >= MIN_NONZOMBIES );
}
#undef MIN_NONZOMBIES
EDIT: Sorry, just woke. Gimme a sec.
EDIT2:
pawn Код:
new NonZombieCount;
foreach( Player, i )
{
if( PlayerTeam[i] != ZOMBIE_TEAM ) NonZombieCount++;
}
if( !NonZombieCount )
{
new PlayersAssigned, pID;
do{
pID = Iter_Random(Player);
if( PlayerTeam[pID] == ZOMBIE_TEAM )
{
PlayerTeam[pID] = HUMAN_TEAM;
PlayersAssigned++;
}
}
while( PlayersAssigned >= MIN_NONZOMBIES );
}