SetPlayerTeam

Category: Player
Since engine version: 4.9.6.0 CR

Description

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

Syntax

int SetPlayerTeam (int iPlr, int idNewTeam, bool fDoNoCalls);

Parameters

iPlr:
Player number of the player whose team assignment you want to change.
idNewTeam:
Team number of the team to be joined.
fDoNoCalls:
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, April 2008