# Vehicle

Utility functions for reading vehicle state on the client.

## isVehicleLocked

Returns whether a vehicle's doors are locked.

```lua
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.

```lua
local lights = KOJA.Client.areVehicleLightsOn(vehicle)
```

**Returns** `boolean`

## isVehicleEngineOn

Returns whether the vehicle's engine is running.

```lua
local running = KOJA.Client.isVehicleEngineOn(vehicle)
```

**Returns** `boolean`

## checkVehicleType

Returns the type of the vehicle as a string.

```lua
local vtype = KOJA.Client.checkVehicleType(vehicle)
```

**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.

```lua
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.

```lua
local rounded = KOJA.Client.RoundNumber(number)
```

**Returns** `number`

## Example

```lua
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
```

## Related pages

- [Getting Started](/koja-lib/getting-started) — Configuration and Installation for Getting Started.
- [API Reference](/koja-lib/api-reference) — Client API and Server API for API Reference.
- [Frameworks](/koja-lib/frameworks) — Custom Framework and Overview for Frameworks.
- [Inventory](/koja-lib/inventory) — Custom Inventory and Overview for Inventory.
- [Weapon](/koja-lib/weapon) — Utility function for reading the player's current weapon state.
- [Text UI](/koja-lib/text-ui) — A small on-screen prompt that shows an action key and a label.
