It
does execute the code within the loop. But your code does not do anything because it does not fall within the paramters of your if statements.
get_user_team(x) will not work on the player that just executed the command to join the team.
Think of the sequence of it:
1-Player joins server, with "no team assigned yet."
2-Player executes the "jointeam" command.
3-AMXX interrupts the command and executes code.
4-Player is then assigned to the team he joined.
Theoretically, you could
block the person from joining the team, which is why AMXX interrupts and comes before, not after in this case.
So anyway,
Instead of doing a get_user_team() on the player joining the team, you should instead read the argument of the command being executed.
Code:
public cmd_jointeam(id) {
new args[8];
read_args( args, 7 );
new new_team = str_to_num( args );
}
In the above code block, the integer variable new_team will be equal to the team the client tried to join. Like I said, get_user_team() won't return anything for that client yet as the team has yet to be set.
__________________