Vehicle

Utility functions for reading vehicle state on the client.

isVehicleLocked

Returns whether a vehicle's doors are locked.

local locked = KOJA.Client.isVehicleLocked(vehicle)
Parameter
Type
Description

vehicle

number

Vehicle entity handle

Returns boolean

areVehicleLightsOn

Returns whether the vehicle's lights are on.

local lights = KOJA.Client.areVehicleLightsOn(vehicle)

Returns boolean

isVehicleEngineOn

Returns whether the vehicle's engine is running.

local running = KOJA.Client.isVehicleEngineOn(vehicle)

Returns boolean

checkVehicleType

Returns the type of the vehicle as a string.

Returns string

Return value
Type

"car"

Standard car

"plane"

Fixed-wing aircraft

"boat"

Boat

"bicycle"

Bicycle

"motorcycle"

Motorcycle

"helicopter"

Helicopter

"train"

Train

"unknown"

Anything else

GetFuel

Returns the vehicle's fuel level. Supports ox_fuel, LegacyFuel, and the native GTA fuel level.

Returns number — fuel level (0–100), or false if unavailable.

RoundNumber

Rounds a number to the nearest 0.5.

Returns number

Example

Last updated