Skip to content
M2O Scripting APIScripting reference
Runtime classClient APIGenerated

Player

Defined in: client/api.d.ts:1611

Client handle for a streamed M2O player.

new Player(id): Player

Defined in: client/api.d.ts:1616

Creates a script wrapper for an existing streamed player with this ID; it does not create or spawn a player.

number

Network entity identifier.

Player

getBoneTransform(boneId): BoneTransform | null

Defined in: client/api.d.ts:1629

Resolves the current world-space transform of one of this player’s skeleton bones.

number

Numeric bone identifier, typically obtained from the global Bone table.

BoneTransform | null

The bone transform, or null when the player or requested bone is unavailable.


getNametagColor(): number

Defined in: client/api.d.ts:4026

Reads this player’s nametag color.

number

Packed 0xAARRGGBB color; opaque white when untinted.

BasePlayer.getNametagColor


getNametagText(): string

Defined in: client/api.d.ts:4020

Reads this player’s nametag text override.

string

The override, or an empty string when the player’s own name is drawn.

BasePlayer.getNametagText


getTeam(): number

Defined in: client/api.d.ts:1647

Returns the team this player belongs to. Teams are assigned by the server; the client only reads them.

number

The team id, or 0 when the player is on no team.


getVehicle(): Vehicle | null

Defined in: client/api.d.ts:1635

Returns the streamed vehicle currently occupied by this player.

Vehicle | null

The current vehicle handle, or null when the player is not inside a streamed vehicle.


getVehicleSeat(): number

Defined in: client/api.d.ts:1641

Returns the seat this player occupies in their current streamed vehicle.

number

The seat index, 0 for the driver, or -1 when the player is not in a vehicle.


isNametagHealthVisible(): boolean

Defined in: client/api.d.ts:4014

Checks whether the health bar under this player’s nametag is shown.

boolean

True unless the health bar was hidden; false also when this game has no nametags.

BasePlayer.isNametagHealthVisible


isNametagVisible(): boolean

Defined in: client/api.d.ts:4008

Checks whether this player’s nametag is shown to other players.

boolean

True unless the nametag was hidden; false also when this game has no nametags.

BasePlayer.isNametagVisible


toString(): string

Defined in: client/api.d.ts:1622

Returns a readable representation of this player handle.

string

The player ID formatted for logging or debugging.

BasePlayer.toString

readonly id: number

Defined in: client/api.d.ts:3926

Immutable network entity identifier.

BasePlayer.id


position: Vector3

Defined in: client/api.d.ts:3936

Authoritative world-space position; assignment forces replicated state.

BasePlayer.position


rotation: Vector3 | Quaternion

Defined in: client/api.d.ts:3941

Authoritative rotation; reads return a quaternion and assignments accept a quaternion or Euler angles in degrees.

BasePlayer.rotation


readonly state: StateBag

Defined in: client/api.d.ts:3946

Arbitrary key/value state carried by this entity. The server writes it and every client that can see the entity receives it; see StateBag.

BasePlayer.state


readonly virtualWorld: number

Defined in: client/api.d.ts:3931

Current virtual-world identifier.

BasePlayer.virtualWorld