# onVehicleExit (Server)

> Fired on the server when a ped leaves a vehicle.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Event
- **Side**: Server
- **Category**: Vehicles
- **URL**: https://wiki.mymp.gg/en/onVehicleExit

## Syntax

```lua
addEventHandler("onVehicleExit", root, function(ped ped, int seat, ped|false jacker, bool forcedByScript) ... end)
```

## Handler parameters

| Name | Type | Description |
| --- | --- | --- |
| `ped` | `ped` | The ped or player that left. |
| `seat` | `int` | The seat: 0 is the driver's, 1 onwards the passengers'. |
| `jacker` | `ped\|false` | The ped that pulled it out, or `false`. |
| `forcedByScript` | `bool` | `true` when it was `removePedFromVehicle`. |

## Source

The vehicle.

It also fires when the ped falls off a bike, is pulled out, dies, leaves the server, moves to another dimension or is taken out by `removePedFromVehicle`.

## Example

```lua
addEventHandler("onVehicleExit", root, function(ped, seat)
    if seat == 0 then
        setVehicleLocked(source, true)
    end
end)
```

## See also

- [onVehicleStartExit (Server)](https://wiki.mymp.gg/en/onVehicleStartExit.md): Fired on the server when a ped starts getting out of a vehicle or is about to be pulled out. Cancelling the event stops it.
- [onVehicleEnter (Server)](https://wiki.mymp.gg/en/onVehicleEnter.md): Fired on the server when a ped has finished getting into a vehicle.
- [onPlayerVehicleExit (Server)](https://wiki.mymp.gg/en/onPlayerVehicleExit.md): Fired on the server when a player leaves a vehicle.
- [onClientVehicleExit (Client)](https://wiki.mymp.gg/en/onClientVehicleExit.md): Fired on the client when a ped leaves a vehicle.
