SetPlayerTeam
Puts the player in a team - teammates cannot hurt each other.
Any number is a team; NO_TEAM (-1) is none. A hit between two players of one team is refused before
OnPlayerDamage and starts no fight. Nothing else is implied - no colour, no label, no spawn: those are the mode’s
to set alongside. A mode that wants friendly fire back writes its rule in OnPlayerDamage and leaves teams unset.
Syntax
Section titled “Syntax”SetPlayerTeam(pid, team)| Parameter | Type | |
|---|---|---|
pid |
number | the player |
team |
number | the team; NO_TEAM (-1) = none |
Returns
Section titled “Returns”boolean - false when not connected
Example
Section titled “Example”local function join(pid, team) SetPlayerTeam(pid, team) SetPlayerColour(pid, team == 1 and 0xFF4040FF or 0x4080FFFF) SetPlayerState(pid, "team", team) -- the client scripts read KcdMp.state.player[pid].teamendSee also
Section titled “See also”GetPlayerTeam · SetPlayerColour · OnPlayerDamage · SetPlayerState · the Players group of the index
