Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

  • new Ped(model: string | number, position: IVector3, rotation: IVector3, streamingDistance?: number): Ped

Properties

armour

armour: number

collision

collision: boolean

currentWeapon

currentWeapon: number

dimension

dimension: number

Object dimension.

remarks

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

frozen

frozen: boolean

health

health: number

Readonly id

id: number

maxHealth

maxHealth: number

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.

pos

pos: Vector3

Object position.

Readonly refCount

refCount: number

Returns the ref count of the entity.

remarks

It's only available in debug-mode.

rot

rot: Vector3

Entity rotation.

remarks

Values are provided in radians.

streamed

streamed: boolean

Whether the entity should be streamed for other entities.

streamingDistance

streamingDistance: number

Readonly timestamp

timestamp: number

Readonly type

Type of the object.

Readonly valid

valid: boolean

Object usability.

returns

False if object is no longer usable.

visible

visible: boolean

Whether the entity is visible.

Static Readonly all

all: readonly Ped[]

Static Readonly count

count: number

Accessors

model

  • get model(): number
  • set model(model: number | string): any
  • Entity model hash.

    Returns number

  • Entity model hash.

    Parameters

    • model: number | string

    Returns any

Methods

attachTo

  • attachTo(entity: Entity, entityBone: number | string, ownBone: number | string, pos: IVector3, rot: IVector3, enableCollisions: boolean, noFixedRotation: boolean): void
  • Attaches this entity to another entity.

    Parameters

    • entity: Entity

      Target entity.

    • entityBone: number | string

      Target bone id or name.

    • ownBone: number | string

      Origin bone id or name.

    • pos: IVector3

      Position offset.

    • rot: IVector3

      Rotation - needs to be in radians.

    • enableCollisions: boolean

      If true the attached entity has a collision.

    • noFixedRotation: boolean

      If false the entity is attached with a fixed rotation (no bouncing). That means if the value in native was true, you have to use false in the serverside method

    Returns void

deleteMeta

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

deleteStreamSyncedMeta

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

deleteSyncedMeta

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

destroy

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

    Returns void

detach

  • detach(): void
  • Detaches this entity if attached to another entity.

    Returns void

getMeta

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

getMetaDataKeys

  • getMetaDataKeys(): readonly string[]

getStreamSyncedMeta

  • getStreamSyncedMeta<K>(key: Exclude<K, keyof ICustomEntityStreamSyncedMeta>): unknown
  • getStreamSyncedMeta<K>(key: K): ICustomEntityStreamSyncedMeta[K] | undefined
  • getStreamSyncedMeta<V>(key: string): V | undefined

getStreamSyncedMetaKeys

  • getStreamSyncedMetaKeys(): readonly string[]

getSyncedMeta

  • getSyncedMeta<K>(key: Exclude<K, keyof ICustomEntitySyncedMeta>): unknown
  • getSyncedMeta<K>(key: K): ICustomEntitySyncedMeta[K] | undefined
  • getSyncedMeta<V>(key: string): V | undefined

getSyncedMetaKeys

  • getSyncedMetaKeys(): readonly string[]

hasMeta

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

hasStreamSyncedMeta

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

    Parameters

    • key: string

      The key of the value to locate.

    Returns boolean

    True if the meta table contains any data at the specified key or False if not

  • Type parameters

    Parameters

    • key: K

    Returns boolean

hasSyncedMeta

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

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

setMeta

  • setMeta<K>(key: K, value: shared.InterfaceValueByKey<ICustomEntityMeta, K>): void
  • setMeta<K>(key: K, value: ICustomEntityMeta[K]): void
  • setMeta<V, K>(key: K, value: shared.InterfaceValueByKey<ICustomEntityMeta, K, V>): 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<K>(key: K, value: shared.InterfaceValueByKey<ICustomEntityStreamSyncedMeta, K>): void
  • setStreamSyncedMeta<K>(key: K, value: ICustomEntityStreamSyncedMeta[K]): void
  • setStreamSyncedMeta<V, K>(key: K, value: shared.InterfaceValueByKey<ICustomEntityStreamSyncedMeta, K, V>): void

setSyncedMeta

  • setSyncedMeta<K>(key: K, value: shared.InterfaceValueByKey<ICustomEntitySyncedMeta, K>): void
  • setSyncedMeta<K>(key: K, value: ICustomEntitySyncedMeta[K]): void
  • setSyncedMeta<V, K>(key: K, value: shared.InterfaceValueByKey<ICustomEntitySyncedMeta, K, V>): void

Static getByID

  • getByID(id: number): Ped | null
  • Retrieves the ped from the pool.

    Parameters

    • id: number

      The id of the ped.

    Returns Ped | null

    Entity if it was found, otherwise null.