SetPlayerTeam

From SA-MP Wiki

Jump to: navigation, search


Description:

Set the team of a player.


Image:32px-Ambox_warning_orange.png

Notes

  • Players can not damage/kill players on the same team unless they use a knife to slit their throat. As of SA-MP 0.3x, players are also unable to damage vehicles driven by a player from the same team. This can be enabled with EnableVehicleFriendlyFire.
  • 255 (or NO_TEAM) is the default team to be able to shoot other players, not 0.


Parameters:
(playerid, teamid)
playeridThe ID of the player you want to set the team of.
teamidThe team to put the player in. Use NO_TEAM to remove the player from any team.


Return Values:

This function does not return any specific values.


Example Usage:

public OnPlayerSpawn(playerid)
{
    // Set a player's team to 4 when they spawn
    SetPlayerTeam(playerid, 4);
    return 1;
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.

Personal tools
Navigation
Toolbox
In other languages