Koja Scripts
KOJA-LIB

Vehicle

Utility functions for reading vehicle state on the client.

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)
ParameterTypeDescription
vehiclenumberVehicle 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.

local vtype = KOJA.Client.checkVehicleType(vehicle)

Returns string

Return valueType
"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.

local fuel = KOJA.Client.GetFuel(vehicle)

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

RoundNumber

Rounds a number to the nearest 0.5.

local rounded = KOJA.Client.RoundNumber(number)

Returns number

Example

local ped     = PlayerPedId()
local vehicle = GetVehiclePedIsIn(ped, false)

if vehicle ~= 0 then
    print('Type:', KOJA.Client.checkVehicleType(vehicle))
    print('Engine:', KOJA.Client.isVehicleEngineOn(vehicle))
    print('Fuel:', KOJA.Client.GetFuel(vehicle))
    print('Locked:', KOJA.Client.isVehicleLocked(vehicle))
end
  • Getting Started — Configuration and Installation for Getting Started.
  • API Reference — Client API and Server API for API Reference.
  • Frameworks — Custom Framework and Overview for Frameworks.
  • Inventory — Custom Inventory and Overview for Inventory.
  • Weapon — Utility function for reading the player's current weapon state.
  • Text UI — A small on-screen prompt that shows an action key and a label.