Skip to content

Vehicle ​

@vimp-mp/types 2.0.1

Interface · Client API

Server-known vehicle. It may be known before/after streaming into a local GTA entity.

ts
interface Vehicle

Members ​

alpha ​

ts
readonly alpha: number

Current entity opacity.

bodyHealth ​

ts
readonly bodyHealth: number

Current body health reported by GTA.

customPrimaryColour ​

ts
readonly customPrimaryColour: Rgb

Current custom primary RGB color.

customSecondaryColour ​

ts
readonly customSecondaryColour: Rgb

Current custom secondary RGB color.

dimension ​

ts
readonly dimension: number

Current virtual world dimension.

engineHealth ​

ts
readonly engineHealth: number

Current engine health reported by GTA.

forwardVector ​

ts
readonly forwardVector: Vec3

Current forward direction vector.

gear ​

ts
readonly gear: number

Current transmission gear.

handle ​

ts
readonly handle: number

GTA entity handle, or 0 while known but not streamed.

heading ​

ts
readonly heading: number

Current heading in degrees.

id ​

ts
readonly id: number

Client-local 0-based wrapper id, unique per entity type and reused after destroy. Use remoteId for server/network state.

isAlive ​

ts
readonly isAlive: boolean

True while the remote vehicle exists in multiplayer state. Use handle !== 0 for local streamed visibility.

isDead ​

ts
readonly isDead: boolean

Whether GTA reports the vehicle as destroyed.

isEngineRunning ​

ts
readonly isEngineRunning: boolean

Whether the engine is currently running.

isExists ​

ts
readonly isExists: boolean

Alias of isAlive for vehicle lifecycle existence.

isLocked ​

ts
readonly isLocked: boolean

Whether the vehicle doors are locked.

isRemote ​

ts
readonly isRemote: boolean

Whether the vehicle is owned by the server rather than this client.

lightsState ​

ts
readonly lightsState: VehicleLightState

Current low-beam and high-beam state.

maxNumberOfPassengers ​

ts
readonly maxNumberOfPassengers: number

Maximum number of passenger seats.

model ​

ts
readonly model: number

Current vehicle model hash.

numberPlate ​

ts
readonly numberPlate: string

Authoritative cached network plate text for remote vehicles.

numberPlateType ​

ts
readonly numberPlateType: number

Cached network plate type for remote vehicles.

position ​

ts
readonly position: Vec3

Current world position.

remoteId ​

ts
readonly remoteId: number | null

Server vehicle id for remote vehicles; null for local-only vehicles. Zero is a valid remote id.

rotation ​

ts
readonly rotation: Vec3

Current world rotation in degrees.

speed ​

ts
readonly speed: number

Current speed reported by GTA.

wheelType ​

ts
readonly wheelType: number

Current GTA wheel-type index.

windowTint ​

ts
readonly windowTint: number

Current GTA window-tint index.

attachToEntity ​

ts
attachToEntity(target: { handle: number }, boneIndex: number, offset: Vec3, rotation: Vec3, p9: boolean, useSoftPinning: boolean, collision: boolean, isPed: boolean, vertexIndex: number, fixedRot: boolean): void

Attaches the vehicle to another GTA entity.

destroy ​

ts
destroy(): boolean

Destroys local-only vehicles. Returns false for remote vehicles or already-destroyed wrappers.

detach ​

ts
detach(useDetachVelocity: boolean, collision: boolean): void

Detaches the vehicle from its current parent entity.

explode ​

ts
explode(audible?: boolean, invisible?: boolean): void

Explodes the local GTA vehicle.

freezePosition ​

ts
freezePosition(freeze: boolean): void

Freezes or unfreezes the vehicle's current position.

getAcceleration ​

ts
getAcceleration(): number

Returns the model's acceleration capability.

getBoneIndexByName ​

ts
getBoneIndexByName(boneName: string): number

Resolves a named bone on the native vehicle, or returns -1.

getHandling ​

ts
getHandling(field: string): number

Returns a numeric handling field from this vehicle instance.

getMaxBraking ​

ts
getMaxBraking(): number

Returns the model's maximum braking capability.

getMaxTraction ​

ts
getMaxTraction(): number

Returns the model's maximum traction capability.

getMod ​

ts
getMod(modType: number): number

Returns the installed mod index for a GTA vehicle-mod slot.

getModelMaxSpeed ​

ts
getModelMaxSpeed(): number

Returns the model's estimated maximum speed.

getNumMods ​

ts
getNumMods(modType: number): number

Returns the number of mods available for a GTA vehicle-mod slot.

getOffsetFromInWorldCoords ​

ts
getOffsetFromInWorldCoords(offsetX: number, offsetY: number, offsetZ: number): Vec3

Converts a vehicle-local offset into world coordinates.

getPedInSeat ​

ts
getPedInSeat(seat: number): number

Returns the GTA ped handle occupying seat, or 0 when it is empty.

getSpeed ​

ts
getSpeed(): number

Returns the vehicle's current speed in metres per second.

getWorldPositionOfBone ​

ts
getWorldPositionOfBone(boneIndex: number): Vec3

Returns the world position of a native vehicle bone.

isPlayingAnim ​

ts
isPlayingAnim(dictionary: string, name: string, taskFlag: number): boolean

Reports whether the vehicle entity is playing the requested animation.

modifyTopSpeed ​

ts
modifyTopSpeed(value: number): void

Adjusts the vehicle's top-speed modifier.

resetAlpha ​

ts
resetAlpha(): void

Restores the vehicle's default opacity.

setAlpha ​

ts
setAlpha(alpha: number): void

Sets opacity, clamped to 0–255, and caches it across stream-in.

setBodyHealth ​

ts
setBodyHealth(value: number): void

Changes the native vehicle's body-health value.

setCheatPowerIncrease ​

ts
setCheatPowerIncrease(value: number): void

Applies GTA's vehicle cheat-power multiplier.

setCollision ​

ts
setCollision(collision: boolean, keepPhysics: boolean): void

Enables or disables collision on the native vehicle when streamed.

setCoords ​

ts
setCoords(xPos: number, yPos: number, zPos: number, xAxis: boolean, yAxis: boolean, zAxis: boolean, clearArea: boolean): void

Moves the native vehicle using GTA's axis and area-clear flags.

setCustomPrimaryColour ​

ts
setCustomPrimaryColour(color: Rgb): void

Applies a custom RGB primary paint colour.

setCustomSecondaryColour ​

ts
setCustomSecondaryColour(color: Rgb): void

Applies a custom RGB secondary paint colour.

setDashboardColor ​

ts
setDashboardColor(colorIndex: number): void

Applies a dashboard colour index.

setDimension ​

ts
setDimension(dimension: number): void

Changes the client-side dimension value associated with this wrapper.

setDoorOpen ​

ts
setDoorOpen(doorIndex: number, loose: boolean, openInstantly: boolean): void

Opens one native vehicle door.

setDoorShut ​

ts
setDoorShut(doorIndex: number, instantly: boolean): void

Closes one native vehicle door.

setEngineHealth ​

ts
setEngineHealth(value: number): void

Changes the native vehicle's engine-health value.

setEngineOn ​

ts
setEngineOn(toggle: boolean, instantly?: boolean, otherwise?: boolean): void

Starts or stops the native vehicle engine.

setEnginePowerMultiplier ​

ts
setEnginePowerMultiplier(value: number): void

Applies GTA's per-frame engine-power multiplier.

setEngineTorqueMultiplier ​

ts
setEngineTorqueMultiplier(value: number): void

Applies GTA's per-frame engine-torque multiplier.

setExtraColours ​

ts
setExtraColours(pearlescentColor: number, wheelColor: number): void

Applies pearlescent and wheel palette colours.

setHandling ​

ts
setHandling(field: string, value: number): void

Overrides a numeric handling field on this vehicle instance.

setHeading ​

ts
setHeading(heading: number): void

Updates the cached heading and the native vehicle when streamed.

setHeadlightColor ​

ts
setHeadlightColor(colorIndex: number): void

Applies a xenon-headlight colour index.

setInteriorColor ​

ts
setInteriorColor(colorIndex: number): void

Applies an interior colour index.

setInvincible ​

ts
setInvincible(invincible: boolean): void

Enables or disables damage on the native vehicle when streamed.

setIsLocked ​

ts
setIsLocked(value: boolean): void

Locks or unlocks all vehicle doors using GTA lock states 2 and 1.

setMod ​

ts
setMod(modType: number, modIndex: number): void

Installs a mod index in a GTA vehicle-mod slot.

setModColor1 ​

ts
setModColor1(paintType: number, color: number, p3: number): void

Applies the primary vehicle-mod paint type and palette colour.

setModel ​

ts
setModel(model: string | number): void

Reserved model setter; the current runtime leaves the vehicle unchanged.

setNeonLightEnabled ​

ts
setNeonLightEnabled(index: number, toggle: boolean): void

Enables or disables one neon-light position.

setNeonLightsColour ​

ts
setNeonLightsColour(color: Rgb): void

Applies the RGB colour shared by the vehicle's neon lights.

setNumberPlate ​

ts
setNumberPlate(value: string): void

Changes the cached and native plate text, truncated to eight characters.

setNumberPlateType ​

ts
setNumberPlateType(index: number): void

Applies a GTA number-plate style index.

setPosition ​

ts
setPosition(position: Vec3): void

Updates the cached position and moves the native vehicle when streamed.

setRotation ​

ts
setRotation(rotation: Vec3): void

Updates the cached rotation and the native vehicle when streamed.

setTyreSmokeColor ​

ts
setTyreSmokeColor(r: number, g: number, b: number): void

Applies an RGB tyre-smoke colour.

setUndriveable ​

ts
setUndriveable(toggle: boolean): void

Enables or disables the native vehicle's undriveable flag.

setVisible ​

ts
setVisible(visible: boolean): void

Shows or hides the native vehicle when streamed.

setWheelType ​

ts
setWheelType(wheelType: number): void

Applies a GTA wheel-type index.

setWindowTint ​

ts
setWindowTint(tintType: number): void

Applies a GTA window-tint index.

toggleMod ​

ts
toggleMod(modType: number, toggle: boolean): void

Enables or disables a toggle-style vehicle mod.

VIMP developer documentation