Garry's Mod Wiki

team

The team library gives you access to the team system built into the Source engine, and allows you to create custom teams and get information about them.

Methods

team.AddScore( number index, number increment )
Increases the score of the given team
Returns the team index of the team with the least players. Falls back to TEAM_UNASSIGNED
Returns the real table consisting of information on every defined team
table team.GetClass( number index )
Returns the selectable classes for the given team. This can be added to with team. SetClass
table team.GetColor( number teamIndex )
Returns the team's color.
string team.GetName( number teamIndex )
Returns the name of the team.
table team.GetPlayers( number teamIndex )
Returns a table with all player of the specified team. This function returns a sequential table, meaning it should be looped with ipairs instead of pairs for efficiency reasons.
number team.GetScore( number teamIndex )
Returns the score of the team.
table team.GetSpawnPoint( number index )
Returns a table of valid spawnpoint classes the team can use. These are set with team. SetSpawnPoint.
Returns a table of valid spawnpoint entities the team can use. These are set with team. SetSpawnPoint.
boolean team.Joinable( number index )
Returns if a team is joinable or not. This is set in team. SetUp.
number team.NumPlayers( number teamIndex )
Returns the amount of players in a team.
team.SetClass( number index, any classes )
Sets valid classes for use by a team. Classes can be created using player_manager. RegisterClass
team.SetColor( number teamIndex, table color )
Sets the team's color.
team.SetScore( number index, number score )
Sets the score of the given team
team.SetSpawnPoint( number index, any classes )
Sets valid spawnpoint classes for use by a team. GM. TeamBased must be set to true for this to work
team.SetUp( number teamIndex, string teamName, table teamColor, boolean isJoinable = true )
Creates a new team. See GM:CreateTeams for the hook to call this in.
number team.TotalDeaths( number index )
Returns the total number of deaths of all players in the team.
number team.TotalFrags( Entity Entity or number )
Get's the total frags in a team.
boolean team.Valid( number index )
Returns true if the given team index is valid