Skip to main content
Branch: Release Candidate

LocalPed

Hierarchy

  • Ped
    • LocalPed

Index

Constructors

publicconstructor

  • new LocalPed(model: string | number, dimension: number, pos: IVector3, rot: IVector3): LocalPed
  • new LocalPed(model: string | number, dimension: number, pos: IVector3, rot: IVector3, useStreaming: true, streamingDistance: number): LocalPed
  • Creates static local ped without streaming enabled.

Properties

publicreadonlyarmour

armour: number

Current armour.

publicreadonlycurrentWeapon

currentWeapon: number

Currently equipped weapon.

publicdimension

dimension: number

Object dimension.

Remarks

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

publicfrozen

frozen: boolean

publicreadonlyhealth

health: number

Current health of the ped.

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.

publicreadonlyisStreamedIn

isStreamedIn: boolean

publicreadonlymaxHealth

maxHealth: number

Current max health of the ped.

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

publicreadonlyscriptID

scriptID: number

publicreadonlystreamingDistance

streamingDistance: number

publicreadonlytype

type: BaseObjectType

Type of the object.

publicreadonlyvalid

valid: boolean

Object usability.

Returns

False if object is no longer usable.

publicvisible

visible: boolean

publicstaticreadonlyall

all: readonly Ped[]

publicstaticreadonlycount

count: number

publicstaticreadonlystreamedIn

streamedIn: readonly Ped[]

Accessors

publicmodel

  • get model(): number
  • set model(model: string | number): void

    Getter

    Setter

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 | ICustomPedMeta[K]
  • Type parameters

    • K: string

publicgetMetaDataKeys

  • getMetaDataKeys(): readonly string[]

publicgetStreamSyncedMeta

  • getStreamSyncedMeta<K>(key: Exclude<K, never>): unknown
  • getStreamSyncedMeta<K>(key: K): undefined | ICustomPedStreamSyncedMeta[K]
  • Type parameters

    • K: string

publicgetStreamSyncedMetaKeys

  • getStreamSyncedMetaKeys(): readonly string[]

publicgetSyncInfo

  • getSyncInfo(): ISyncInfo

publicgetSyncedMeta

  • getSyncedMeta<K>(key: Exclude<K, never>): unknown
  • getSyncedMeta<K>(key: K): undefined | ICustomPedSyncedMeta[K]
  • 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

publichasSyncedMeta

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

publicsetMeta

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

    • K: string

publicwaitForSpawn

  • waitForSpawn(timeout?: number): Promise<void>
  • Waits asynchronously until the ped spawns.

publicstaticgetByID

  • getByID(id: number): null | LocalPed
  • Retrieves the localPed from the pool.

publicstaticgetByRemoteID

  • getByRemoteID(id: number): null | Ped
  • Gets the ped with the given remote id

publicstaticgetByScriptID

  • getByScriptID(scriptID: number): null | LocalPed
  • Retrieves the localPed from the pool.