Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Player

Hierarchy

Index

Properties

armour

armour: number

Readonly authToken

authToken: string

currentWeapon

currentWeapon: number

Readonly currentWeaponComponents

currentWeaponComponents: Array<number>

Readonly currentWeaponTintIndex

currentWeaponTintIndex: number

dimension

dimension: number

Object dimension.

Readonly entityAimOffset

entityAimOffset: Vector3

Readonly entityAimingAt

entityAimingAt: Entity | null

Readonly flashlightActive

flashlightActive: boolean

health

health: number

Readonly hwidExHash

hwidExHash: string

Readonly hwidHash

hwidHash: string

Readonly id

id: number

Internal identificator of the entity which is identical on both sides.

Readonly ip

ip: string

maxArmour

maxArmour: number

maxHealth

maxHealth: number

model

model: number | string

Entity model hash.

remarks

Only setter accepts string or number as input, getter returns value as number.

Readonly name

name: string

Readonly netOwner

netOwner: Player | null

Network owner of the entity.

remarks

Network owner is responsible for syncing entity with the server. It changes when actual network owner passes the migration range, then the new one is determined based on distance from the entity (if entity is a vehicle, then the driver will take priority for becoming network owner). Disabling migration range will stop this process from happening until turned on again.

Readonly ping

ping: number

pos

pos: Vector3

Object position.

rot

rot: Vector3

Entity rotation.

remarks

Values are provided in radians .

Readonly seat

seat: number

Readonly socialId

socialId: string

Readonly type

Type of the object.

Readonly valid

valid: boolean

Object usability.

returns

False if object is no longer usable.

Readonly vehicle

vehicle: Vehicle | null

visible

visible: boolean
beta

Static all

all: Array<Player>

Methods

addWeaponComponent

  • addWeaponComponent(weaponHash: number, component: number): void

clearBloodDamage

  • clearBloodDamage(): void

deleteMeta

  • deleteMeta(key: string): void

deleteStreamSyncedMeta

  • deleteStreamSyncedMeta(key: string): void

deleteSyncedMeta

  • deleteSyncedMeta(key: string): void

destroy

  • destroy(): void

getMeta

  • getMeta(key: string): any
  • Gets a value using the specified key.

    Parameters

    • key: string

      The key of the value to get.

    Returns any

    Dynamic value associated with the specified key.

getStreamSyncedMeta

  • getStreamSyncedMeta(key: string): any

getSyncedMeta

  • getSyncedMeta(key: string): any
  • Gets a value using the specified key.

    Parameters

    • key: string

      The key of the value to get.

    Returns any

    Dynamic value associated with the specified key.

giveWeapon

  • giveWeapon(weaponHash: number, ammo: number, equipNow: boolean): void
  • Parameters

    • weaponHash: number
    • ammo: number
    • equipNow: boolean

    Returns void

hasMeta

  • hasMeta(key: string): boolean
  • Determines whether contains the specified key.

    Parameters

    • key: string

      The key of the value to locate.

    Returns boolean

    True when element associated with the specified key is stored.

hasStreamSyncedMeta

  • hasStreamSyncedMeta(key: string): boolean
  • Determines whether contains the specified key.

    Parameters

    • key: string

      The key of the value to locate.

    Returns boolean

    Return is dependent on whether element associated with the specified key is stored.

hasSyncedMeta

  • hasSyncedMeta(key: string): boolean
  • Determines whether contains the specified key.

    Parameters

    • key: string

      The key of the value to locate.

    Returns boolean

    Return is dependent on whether element associated with the specified key is stored.

kick

  • kick(reason?: string): void
  • Forcefully disconnects the player with a reason message.

    Parameters

    • Optional reason: string

      The reason that will display to the player on the disconnect screen. If not specified, it defaults to "KICKED_OUT".

    Returns void

removeAllWeapons

  • removeAllWeapons(): void

removeWeapon

  • removeWeapon(weaponHash: number): void

removeWeaponComponent

  • removeWeaponComponent(weaponHash: number, component: number): void

resetNetOwner

  • resetNetOwner(disableMigration?: boolean): void
  • Resets overwritten network owner.

    remarks

    See {@link Entity~netOwner} to understand how network owner works.

    Keep in mind that disabling migration can lead to unexpected behaviour when the network owner gets out of the streaming range.

    Parameters

    • Optional disableMigration: boolean

      Pass true to disable migration, false to keep it enabled. If not specified, it defaults to "false".

    Returns void

setDateTime

setMeta

  • setMeta(key: string, value: any): void
  • Stores the given value with the specified key.

    remarks

    The given value will be shared locally.

    Parameters

    • key: string

      The key of the value to store.

    • value: any

    Returns void

setNetOwner

  • setNetOwner(player: Player, disableMigration?: boolean): void
  • Changes network owner to the specified player.

    remarks

    See {@link Entity~netOwner} to understand how network owner works.

    Keep in mind that disabling migration can lead to unexpected behaviour when the network owner gets out of the streaming range.

    Parameters

    • player: Player

      The given player that will be set as new network owner.

    • Optional disableMigration: boolean

      Pass true to disable migration, false to keep it enabled. If not specified, it defaults to "false".

    Returns void

setStreamSyncedMeta

  • setStreamSyncedMeta(key: string, value: any): void
  • Stores the given value with the specified key.

    remarks

    The given value will be shared with all clients in streaming range.

    Parameters

    • key: string

      The key of the value to store.

    • value: any

    Returns void

setSyncedMeta

  • setSyncedMeta(key: string, value: any): void
  • Stores the given value with the specified key.

    remarks

    The given value will be shared with all clients.

    Parameters

    • key: string

      The key of the value to store.

    • value: any

    Returns void

setWeaponTintIndex

  • setWeaponTintIndex(weaponHash: number, tintIndex: number): void

setWeather

spawn

  • spawn(x: number, y: number, z: number, delay: number): void

Static getByID

  • getByID(id: number): Player | null
  • Retrieves the player from the pool.

    Parameters

    • id: number

      The id of the player.

    Returns Player | null

    Player if it was found, otherwise null.