Skip to main content
Branch: Development

Object

Hierarchy

  • Entity
    • Object

Index

Properties

publicreadonlyalpha

alpha: number

publicdimension

dimension: number

Object dimension.

Remarks

Check https://docs.altv.mp/articles/dimensions.html to understand how it works.

publicfrozen

frozen: boolean

publicreadonlyid

id: number

publicreadonlyisRemote

isRemote: boolean

Whether this entity was created clientside or serverside. (Clientside = false, Serverside = true).

publicreadonlyisSpawned

isSpawned: boolean

Returns whether the entity is spawned in the game world.

Remarks

This does the same thing as checking if the scriptID is 0.

publicreadonlylodDistance

lodDistance: number

The distance at which the LOD model of the object starts being applied.

publicreadonlynetOwner

netOwner: null | Player

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.

publicpos

pos: Vector3

Object position.

Remarks

Setting this throws an error if the client is not the network owner of an entity

publicreadonlyrefCount

refCount: number

Returns the ref count of the entity.

Remarks

It’s only available in debug-mode.

publicreadonlyremoteID

remoteID: number

The serverside id of this entity.

publicrot

rot: Vector3

Entity rotation in radians

Remarks

Setting this throws an error if the client is not the network owner of an entity

publicreadonlyscriptID

scriptID: number

Internal game id that can be used in native calls

publicreadonlytextureVariation

textureVariation: number

publicreadonlytype

type: BaseObjectType

Type of the object.

publicreadonlyvalid

valid: boolean

Object usability.

Returns

False if object is no longer usable.

publicreadonlyvisible

visible: boolean

publicstaticreadonlyall

all: readonly Object[]

publicstaticreadonlycount

count: number

publicstaticreadonlystreamedIn

streamedIn: readonly Object[]

Accessors

publicmodel

  • get model(): number

    Getter

  • Hash of entity model

Methods

publicdeleteMeta

  • deleteMeta(key: string): void
  • deleteMeta<K>(key: K): void

publicdestroy

  • destroy(): void
  • Removes the object from the world.

publicgetMeta

  • getMeta<K>(key: Exclude<K, never>): unknown
  • getMeta<K>(key: K): undefined | ICustomEntityMeta[K]
  • getMeta<V>(key: string): undefined | V
  • Type parameters

    • K: string

publicgetMetaDataKeys

  • getMetaDataKeys(): readonly string[]

publicgetStreamSyncedMeta

  • getStreamSyncedMeta<K>(key: Exclude<K, never>): unknown
  • getStreamSyncedMeta<K>(key: K): undefined | ICustomEntityStreamSyncedMeta[K]
  • getStreamSyncedMeta<V>(key: string): undefined | V
  • Gets a value using the specified key.


    Type parameters

    • K: string

publicgetStreamSyncedMetaKeys

  • getStreamSyncedMetaKeys(): readonly string[]

publicgetSyncInfo

  • getSyncInfo(): ISyncInfo

publicgetSyncedMeta

  • getSyncedMeta<K>(key: Exclude<K, never>): unknown
  • getSyncedMeta<K>(key: K): undefined | ICustomEntitySyncedMeta[K]
  • getSyncedMeta<V>(key: string): undefined | V
  • Gets a value using the specified key.


    Type parameters

    • K: string

publicgetSyncedMetaKeys

  • getSyncedMetaKeys(): readonly string[]

publichasMeta

  • hasMeta(key: string): boolean
  • hasMeta<K>(key: K): boolean

publichasStreamSyncedMeta

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

publichasSyncedMeta

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

publicsetMeta

  • setMeta<K>(key: K, value: InterfaceValueByKey<ICustomEntityMeta, K, unknown, void>): void
  • setMeta<K>(key: K, value: ICustomEntityMeta[K]): void
  • setMeta<V, K>(key: K, value: InterfaceValueByKey<ICustomEntityMeta, K, V, void>): void
  • Type parameters

    • K: string

publicstaticgetByID

  • getByID(id: number): null | Object

publicstaticgetByRemoteID

  • getByRemoteID(id: number): null | Object
  • Gets the object with the given remote id

publicstaticgetByScriptID

  • getByScriptID(scriptID: number): null | Entity
  • Retrieves the entity from the pool.