The easiest way is to use modulus (the % sign, think of it as "remainder" of division)
PHP Code:
temp.teams = {"Red Team", "Blue Team"}; // array of teams
temp.c = 0;
for (temp.pl : players) { // loop through the players
if (pl.guild == "Events Team") {
continue; // if they have an ET tag, skip them
}
pl.guild = teams[c % teams.size()];
c ++;
}
To add/remove teams just add them to the list at the top.
edit:
Quote:
Originally Posted by Switch
|
You should always prefix your variables unless you intend for them to be global.
Quote:
PHP Code:
for (player : players in the level) {
|
Uhm...what?
Quote:
PHP Code:
player.guild = team;
|
Never use player as a variable name except to refer to the active player; it's reserved.
Quote:
PHP Code:
team = (team=1 ? 2 : 1); //(arg ? true : false)
|
Use == for comparison, like so:
PHP Code:
team = (team == 1 ? 2 : 1);