# getVehicleEngineState (Shared)

> Returns whether a vehicle's engine is on.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Vehicles
- **URL**: https://wiki.mymp.gg/en/getVehicleEngineState

## Syntax

```lua
bool getVehicleEngineState(vehicle vehicle)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `vehicle` | `vehicle` | The vehicle. |

## Returns

`true` if the engine is on. `false` if it is off or the element is not a vehicle.

## Example

```lua
addEventHandler("onVehicleEnter", root, function(ped, seat)
    if seat == 0 and not getVehicleEngineState(source) then
        setVehicleEngineState(source, true)
    end
end)
```

## See also

- [setVehicleEngineState (Shared)](https://wiki.mymp.gg/en/setVehicleEngineState.md): Turns a vehicle's engine on or off.
- [isVehicleLocked (Shared)](https://wiki.mymp.gg/en/isVehicleLocked.md): Returns whether a vehicle's doors are locked.
