Vehicle
@vimp-mp/types 2.0.1Server-known vehicle. It may be known before/after streaming into a local GTA entity.
interface VehicleMembers
alpha
readonly alpha: numberCurrent entity opacity.
bodyHealth
readonly bodyHealth: numberCurrent body health reported by GTA.
customPrimaryColour
readonly customPrimaryColour: RgbCurrent custom primary RGB color.
customSecondaryColour
readonly customSecondaryColour: RgbCurrent custom secondary RGB color.
dimension
readonly dimension: numberCurrent virtual world dimension.
engineHealth
readonly engineHealth: numberCurrent engine health reported by GTA.
forwardVector
readonly forwardVector: Vec3Current forward direction vector.
gear
readonly gear: numberCurrent transmission gear.
handle
readonly handle: numberGTA entity handle, or 0 while known but not streamed.
heading
readonly heading: numberCurrent heading in degrees.
id
readonly id: numberClient-local 0-based wrapper id, unique per entity type and reused after destroy. Use remoteId for server/network state.
isAlive
readonly isAlive: booleanTrue while the remote vehicle exists in multiplayer state. Use handle !== 0 for local streamed visibility.
isDead
readonly isDead: booleanWhether GTA reports the vehicle as destroyed.
isEngineRunning
readonly isEngineRunning: booleanWhether the engine is currently running.
isExists
readonly isExists: booleanAlias of isAlive for vehicle lifecycle existence.
isLocked
readonly isLocked: booleanWhether the vehicle doors are locked.
isRemote
readonly isRemote: booleanWhether the vehicle is owned by the server rather than this client.
lightsState
readonly lightsState: VehicleLightStateCurrent low-beam and high-beam state.
maxNumberOfPassengers
readonly maxNumberOfPassengers: numberMaximum number of passenger seats.
model
readonly model: numberCurrent vehicle model hash.
numberPlate
readonly numberPlate: stringAuthoritative cached network plate text for remote vehicles.
numberPlateType
readonly numberPlateType: numberCached network plate type for remote vehicles.
position
readonly position: Vec3Current world position.
remoteId
readonly remoteId: number | nullServer vehicle id for remote vehicles; null for local-only vehicles. Zero is a valid remote id.
rotation
readonly rotation: Vec3Current world rotation in degrees.
speed
readonly speed: numberCurrent speed reported by GTA.
wheelType
readonly wheelType: numberCurrent GTA wheel-type index.
windowTint
readonly windowTint: numberCurrent GTA window-tint index.
attachToEntity
attachToEntity(target: { handle: number }, boneIndex: number, offset: Vec3, rotation: Vec3, p9: boolean, useSoftPinning: boolean, collision: boolean, isPed: boolean, vertexIndex: number, fixedRot: boolean): voidAttaches the vehicle to another GTA entity.
destroy
destroy(): booleanDestroys local-only vehicles. Returns false for remote vehicles or already-destroyed wrappers.
detach
detach(useDetachVelocity: boolean, collision: boolean): voidDetaches the vehicle from its current parent entity.
explode
explode(audible?: boolean, invisible?: boolean): voidExplodes the local GTA vehicle.
freezePosition
freezePosition(freeze: boolean): voidFreezes or unfreezes the vehicle's current position.
getAcceleration
getAcceleration(): numberReturns the model's acceleration capability.
getBoneIndexByName
getBoneIndexByName(boneName: string): numberResolves a named bone on the native vehicle, or returns -1.
getHandling
getHandling(field: string): numberReturns a numeric handling field from this vehicle instance.
getMaxBraking
getMaxBraking(): numberReturns the model's maximum braking capability.
getMaxTraction
getMaxTraction(): numberReturns the model's maximum traction capability.
getMod
getMod(modType: number): numberReturns the installed mod index for a GTA vehicle-mod slot.
getModelMaxSpeed
getModelMaxSpeed(): numberReturns the model's estimated maximum speed.
getNumMods
getNumMods(modType: number): numberReturns the number of mods available for a GTA vehicle-mod slot.
getOffsetFromInWorldCoords
getOffsetFromInWorldCoords(offsetX: number, offsetY: number, offsetZ: number): Vec3Converts a vehicle-local offset into world coordinates.
getPedInSeat
getPedInSeat(seat: number): numberReturns the GTA ped handle occupying seat, or 0 when it is empty.
getSpeed
getSpeed(): numberReturns the vehicle's current speed in metres per second.
getWorldPositionOfBone
getWorldPositionOfBone(boneIndex: number): Vec3Returns the world position of a native vehicle bone.
isPlayingAnim
isPlayingAnim(dictionary: string, name: string, taskFlag: number): booleanReports whether the vehicle entity is playing the requested animation.
modifyTopSpeed
modifyTopSpeed(value: number): voidAdjusts the vehicle's top-speed modifier.
resetAlpha
resetAlpha(): voidRestores the vehicle's default opacity.
setAlpha
setAlpha(alpha: number): voidSets opacity, clamped to 0–255, and caches it across stream-in.
setBodyHealth
setBodyHealth(value: number): voidChanges the native vehicle's body-health value.
setCheatPowerIncrease
setCheatPowerIncrease(value: number): voidApplies GTA's vehicle cheat-power multiplier.
setCollision
setCollision(collision: boolean, keepPhysics: boolean): voidEnables or disables collision on the native vehicle when streamed.
setCoords
setCoords(xPos: number, yPos: number, zPos: number, xAxis: boolean, yAxis: boolean, zAxis: boolean, clearArea: boolean): voidMoves the native vehicle using GTA's axis and area-clear flags.
setCustomPrimaryColour
setCustomPrimaryColour(color: Rgb): voidApplies a custom RGB primary paint colour.
setCustomSecondaryColour
setCustomSecondaryColour(color: Rgb): voidApplies a custom RGB secondary paint colour.
setDashboardColor
setDashboardColor(colorIndex: number): voidApplies a dashboard colour index.
setDimension
setDimension(dimension: number): voidChanges the client-side dimension value associated with this wrapper.
setDoorOpen
setDoorOpen(doorIndex: number, loose: boolean, openInstantly: boolean): voidOpens one native vehicle door.
setDoorShut
setDoorShut(doorIndex: number, instantly: boolean): voidCloses one native vehicle door.
setEngineHealth
setEngineHealth(value: number): voidChanges the native vehicle's engine-health value.
setEngineOn
setEngineOn(toggle: boolean, instantly?: boolean, otherwise?: boolean): voidStarts or stops the native vehicle engine.
setEnginePowerMultiplier
setEnginePowerMultiplier(value: number): voidApplies GTA's per-frame engine-power multiplier.
setEngineTorqueMultiplier
setEngineTorqueMultiplier(value: number): voidApplies GTA's per-frame engine-torque multiplier.
setExtraColours
setExtraColours(pearlescentColor: number, wheelColor: number): voidApplies pearlescent and wheel palette colours.
setHandling
setHandling(field: string, value: number): voidOverrides a numeric handling field on this vehicle instance.
setHeading
setHeading(heading: number): voidUpdates the cached heading and the native vehicle when streamed.
setHeadlightColor
setHeadlightColor(colorIndex: number): voidApplies a xenon-headlight colour index.
setInteriorColor
setInteriorColor(colorIndex: number): voidApplies an interior colour index.
setInvincible
setInvincible(invincible: boolean): voidEnables or disables damage on the native vehicle when streamed.
setIsLocked
setIsLocked(value: boolean): voidLocks or unlocks all vehicle doors using GTA lock states 2 and 1.
setMod
setMod(modType: number, modIndex: number): voidInstalls a mod index in a GTA vehicle-mod slot.
setModColor1
setModColor1(paintType: number, color: number, p3: number): voidApplies the primary vehicle-mod paint type and palette colour.
setModel
setModel(model: string | number): voidReserved model setter; the current runtime leaves the vehicle unchanged.
setNeonLightEnabled
setNeonLightEnabled(index: number, toggle: boolean): voidEnables or disables one neon-light position.
setNeonLightsColour
setNeonLightsColour(color: Rgb): voidApplies the RGB colour shared by the vehicle's neon lights.
setNumberPlate
setNumberPlate(value: string): voidChanges the cached and native plate text, truncated to eight characters.
setNumberPlateType
setNumberPlateType(index: number): voidApplies a GTA number-plate style index.
setPosition
setPosition(position: Vec3): voidUpdates the cached position and moves the native vehicle when streamed.
setRotation
setRotation(rotation: Vec3): voidUpdates the cached rotation and the native vehicle when streamed.
setTyreSmokeColor
setTyreSmokeColor(r: number, g: number, b: number): voidApplies an RGB tyre-smoke colour.
setUndriveable
setUndriveable(toggle: boolean): voidEnables or disables the native vehicle's undriveable flag.
setVisible
setVisible(visible: boolean): voidShows or hides the native vehicle when streamed.
setWheelType
setWheelType(wheelType: number): voidApplies a GTA wheel-type index.
setWindowTint
setWindowTint(tintType: number): voidApplies a GTA window-tint index.
toggleMod
toggleMod(modType: number, toggle: boolean): voidEnables or disables a toggle-style vehicle mod.