SetPlayerTeam

Category: Player
Since engine version: 1.0 OC

Description

Assigns a player to a new team. The player limit (MaxPlayer) of the team will be considered.

Syntax

int SetPlayerTeam(int player, int new_team, bool no_calls);

Parameters

player:
Player number of the player whose team assignment you want to change.
new_team:
Team number of the team to be joined.
no_calls:
If true, calls to "RejectTeamSwitch" and "OnTeamSwitch" are not made. Also, player hostility is not automatically adjusted (this might have to be done manually instead).

Remark

The function "RejectTeamSwitch" will be called in all game goal, rule, and environment objects. If any of these calls return true, then the team switch will not take place. If the team switch was performed successfully, the function "OnTeamSwitch" is called in all objects mentioned above (including the player number and new and old team numbers).
See also: GetPlayerTeam, Teams
Clonkonaut, 2008-04