Skip to content

Vehicle

@vimp-mp/types 2.0.1

Interface · Server API

Server-spawned vehicle handle returned by vimp.vehicles.create.

Mutating world, appearance, lock and health properties updates the authoritative server state and broadcasts the change to every player currently streaming the vehicle.

ts
interface Vehicle extends StreamSyncedMeta

Members

bodyHealth

ts
bodyHealth: number

Body health, clamped by runtime to 0-1000.

dimension

ts
dimension: number

Virtual world (dimension). The vehicle is visible only to players in the same dimension. Changing it also changes every occupant's dimension without removing them from the vehicle; each player receives a playerDimensionChange event. Defaults to 0.

dirtLevel

ts
dirtLevel: number

Dirt level, clamped by runtime to 0-15.

driver

ts
readonly driver: Player | null

Player in the driver seat (-1 / seat -1 server-side), or null.

engineHealth

ts
engineHealth: number

Engine health, clamped by runtime to -4000..1000.

engineOn

ts
engineOn: boolean

Whether the engine is running.

id

ts
readonly id: number

Server-assigned vehicle identifier.

isExists

ts
readonly isExists: boolean

Whether the vehicle is still registered with the server runtime.

livery

ts
livery: number

Livery index, clamped by runtime to -1..255.

lockState

ts
lockState: number

Door lock state, clamped by runtime to 0-10.

model

ts
model: number

Vehicle model hash.

numberPlate

ts
numberPlate: string

Number plate text, truncated by runtime to 8 characters.

numberPlateType

ts
numberPlateType: number

Number plate style, clamped by runtime to 0-5.

passengers

ts
readonly passengers: Array<Player>

All players currently seated in the vehicle, including the driver.

position

ts
position: Vec3

Authoritative world position.

primaryColor

ts
primaryColor: number

GTA primary paint id, clamped by runtime to 0-255.

rotation

ts
rotation: Vec3

Authoritative world rotation in degrees.

secondaryColor

ts
secondaryColor: number

GTA secondary paint id, clamped by runtime to 0-255.

deleteStreamSyncedMeta

ts
deleteStreamSyncedMeta(key: string): void

Deletes key and propagates the removal to streaming clients.

destroy

ts
destroy(): boolean

Destroy the vehicle and unregister it from vimp.vehicles.

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.

hasStreamSyncedMeta

ts
hasStreamSyncedMeta(key: string): boolean

Returns whether the entity has a value for key.

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.

VIMP developer documentation