Garry's Mod Wiki

team.GetPlayers

  table team.GetPlayers( number teamIndex )

Description

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.

Arguments

1 number teamIndex
The team index.

Returns

1 table
A sequential table of Players that belong to the requested team.

Example

Prints all the players in a player's team.

Output: List of players.

Example

Heals all the players in a player's team.

for _, teammate in ipairs(team.GetPlayers(ply:Team())) do teammate:SetHealth(teammate:GetMaxHealth()) end