> For the complete documentation index, see [llms.txt](https://docs.kojascripts.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kojascripts.eu/koja-lib/vehicle.md).

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kojascripts.eu/koja-lib/vehicle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
