Skip to content

Ped

@vimp-mp/types 2.0.1

Interface · Server API

Server-spawned NPC (pedestrian). Returned from vimp.peds.create.

All readable properties are pass-through to the native ops; mutating world, health, visibility, physics or weapon properties broadcasts a SetPed* message to every player currently streaming the ped, so the change is visible in-game without re-creating the entity.

Use teleport(x, y, z, heading?) to update position and heading in a single broadcast — analogous to Player.teleport.

ts
interface Ped extends StreamSyncedMeta

Members

accuracy

ts
accuracy: number

Ped accuracy, clamped by runtime to 0-100. Default: 0.

alpha

ts
alpha: number

Entity alpha, clamped by runtime to 0-255. Default: 255.

armour

ts
armour: number

Current ped armour.

collision

ts
collision: boolean

Toggle client-side collision. Default: true.

dimension

ts
dimension: number

Virtual world; the ped is visible only to players in the same dimension.

frozen

ts
frozen: boolean

Freeze/unfreeze the streamed native ped. Default: false.

heading

ts
heading: number

Authoritative heading in degrees.

health

ts
health: number

Current ped health.

id

ts
readonly id: number

Server-assigned ped identifier.

invincible

ts
invincible: boolean

Toggle client-side invincibility. Default: false.

isExists

ts
readonly isExists: boolean

Whether the ped is still registered with the server runtime.

maxHealth

ts
maxHealth: number

Maximum health, clamped by runtime to 1-10000.

model

ts
model: number

GTA ped model hash replicated to streaming clients.

position

ts
position: Vec3

Authoritative world position replicated to streaming clients.

rotation

ts
rotation: Vec3

Rotation represented as { x: 0, y: 0, z: heading }.

visible

ts
visible: boolean

Client-side visibility for streamed ped instances. Default: true.

weapon

ts
weapon: Weapon | null

Single authoritative equipped weapon, or null when unarmed.

deleteStreamSyncedMeta

ts
deleteStreamSyncedMeta(key: string): void

Deletes key and propagates the removal to streaming clients.

destroy

ts
destroy(): boolean

Destroys this ped instance.

getStreamSyncedMeta

ts
getStreamSyncedMeta<T = unknown>(key: string): T | undefined

Returns undefined if the key is unset.

getStreamSyncedMetaKeys

ts
getStreamSyncedMetaKeys(): Array<string>

Returns all stream-synced metadata keys stored on the entity.

giveWeapon

ts
giveWeapon(hash: number, ammo?: number): boolean

Equip one authoritative weapon. Defaults ammo to 30.

hasStreamSyncedMeta

ts
hasStreamSyncedMeta(key: string): boolean

Returns whether the entity has a value for key.

removeWeapon

ts
removeWeapon(): boolean

Remove the authoritative ped weapon.

setRotation

ts
setRotation(rotation: Vec3): void

Set rotation; only z is authoritative for VIMP peds.

setStreamSyncedMeta

ts
setStreamSyncedMeta(key: string, value: unknown): void

Set or replace one key. The value is forwarded to every player currently streaming this entity, plus included in the snapshot for any future stream-in. Use deleteStreamSyncedMeta rather than undefined when the key must be removed.

teleport

ts
teleport(x: number, y: number, z: number, heading?: number): boolean

Moves the ped and optionally changes its heading in one replicated update.

VIMP developer documentation