Team
constTeam:object
Defined in: server/api.d.ts:2225
Registry of factions. A team id assigned with player.setTeam decides who may damage whom; friendly fire is on for every pair until a script turns it off.
Type Declaration
Section titled “Type Declaration”areFriendly()
Section titled “areFriendly()”areFriendly(
teamA,teamB):boolean
Reports the answer the damage gate uses for two teams.
Parameters
Section titled “Parameters”number
First team id.
number
Second team id.
Returns
Section titled “Returns”boolean
True when members of the two teams cannot damage each other.
create()
Section titled “create()”create(
name):number
Creates a team and returns its id.
Parameters
Section titled “Parameters”string
Unique team name, truncated to 64 characters.
Returns
Section titled “Returns”number
The new team id, or 0 when the name is already taken or all 31 team slots are in use.
destroy()
Section titled “destroy()”destroy(
team):boolean
Removes a team; every player and NPC on it falls back to no team, and its relations reset to hostile.
Parameters
Section titled “Parameters”number
Team id to remove.
Returns
Section titled “Returns”boolean
True when the team existed.
exists()
Section titled “exists()”exists(
team):boolean
Reports whether a team id is currently registered.
Parameters
Section titled “Parameters”number
Team id to test.
Returns
Section titled “Returns”boolean
True when the id belongs to a live team.
getAll()
Section titled “getAll()”getAll():
number[]
Lists every registered team.
Returns
Section titled “Returns”number[]
The ids of all live teams.
getByName()
Section titled “getByName()”getByName(
name):number
Finds a team by the name it was created with.
Parameters
Section titled “Parameters”string
Team name to look up.
Returns
Section titled “Returns”number
The team id, or 0 when no team carries that name.
getFriendlyFire()
Section titled “getFriendlyFire()”getFriendlyFire(
team):boolean
Reports whether members of a team can damage one another.
Parameters
Section titled “Parameters”number
Team id to query.
Returns
Section titled “Returns”boolean
True when friendly fire is enabled for the team.
getName()
Section titled “getName()”getName(
team):string
Returns the name a team was created with.
Parameters
Section titled “Parameters”number
Team id to name.
Returns
Section titled “Returns”string
The team name, or an empty string when the id is unused.
setFriendlyFire()
Section titled “setFriendlyFire()”setFriendlyFire(
team,enabled):void
Sets whether members of a team can damage one another. Enabled is the default, and matches a server with no teams at all.
Parameters
Section titled “Parameters”number
Team id to configure.
enabled
Section titled “enabled”boolean
True to let members damage each other, false to protect them.
Returns
Section titled “Returns”void
setRelation()
Section titled “setRelation()”setRelation(
teamA,teamB,friendly):void
Sets how two teams treat each other. The relation is symmetric, and a shot at a friendly team neither lands nor blocks the bullet.
Parameters
Section titled “Parameters”number
First team id.
number
Second team id.
friendly
Section titled “friendly”boolean
True to stop the two teams damaging each other, false to allow it.
Returns
Section titled “Returns”void
