Quote:
Originally Posted by Rob_Maate
I'll give you a little snippet out of my code, so you can get the basic idea. You seem to have a relatively firm grasp on pawno, so it shoudln't be a challenge
pawn Код:
public AutoAssign(playerid) { new RedCount, BlueCount; for(new i=0; i<MAX_PLAYERS; i++) { if(EventTeam[i] == EVENT_TEAM_RED) { RedCount ++; } if(EventTeam[i] == EVENT_TEAM_BLUE) { BlueCount ++; } } if(RedCount > BlueCount) { return EVENT_TEAM_BLUE; } if(BlueCount > RedCount) { return EVENT_TEAM_RED; } if(BlueCount == RedCount) { new decide = random(2); if(decide == 0) { return EVENT_TEAM_RED; } if(decide == 1) { return EVENT_TEAM_BLUE; } } return 0; }
|
Stop using loops!!!!! You can increase/decrease the team count within the if statements... Then do a checktowards which team the player is in and decrease the count. Think more effective :O