Skip to content
M2O Scripting APIScripting reference
Global objectServer APIGenerated

Team

const Team: 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.

areFriendly(teamA, teamB): boolean

Reports the answer the damage gate uses for two teams.

number

First team id.

number

Second team id.

boolean

True when members of the two teams cannot damage each other.

create(name): number

Creates a team and returns its id.

string

Unique team name, truncated to 64 characters.

number

The new team id, or 0 when the name is already taken or all 31 team slots are in use.

destroy(team): boolean

Removes a team; every player and NPC on it falls back to no team, and its relations reset to hostile.

number

Team id to remove.

boolean

True when the team existed.

exists(team): boolean

Reports whether a team id is currently registered.

number

Team id to test.

boolean

True when the id belongs to a live team.

getAll(): number[]

Lists every registered team.

number[]

The ids of all live teams.

getByName(name): number

Finds a team by the name it was created with.

string

Team name to look up.

number

The team id, or 0 when no team carries that name.

getFriendlyFire(team): boolean

Reports whether members of a team can damage one another.

number

Team id to query.

boolean

True when friendly fire is enabled for the team.

getName(team): string

Returns the name a team was created with.

number

Team id to name.

string

The team name, or an empty string when the id is unused.

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.

number

Team id to configure.

boolean

True to let members damage each other, false to protect them.

void

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.

number

First team id.

number

Second team id.

boolean

True to stop the two teams damaging each other, false to allow it.

void