# isPedInVehicle (Shared)

> Tells whether a ped or player is in a vehicle.

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

## Syntax

```lua
bool isPedInVehicle(ped ped)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `ped` | `ped` | The ped or player. |

## Returns

`true` if it is in a vehicle, `false` if not or if the element is not a ped.

## Example

```lua
addCommandHandler("eject", function(player)
    if isPedInVehicle(player) then
        removePedFromVehicle(player)
    end
end)
```

## See also

- [getPedOccupiedVehicle (Shared)](https://wiki.mymp.gg/en/getPedOccupiedVehicle.md): Gets the vehicle a ped or player is in.
- [getPedOccupiedVehicleSeat (Shared)](https://wiki.mymp.gg/en/getPedOccupiedVehicleSeat.md): Gets the seat a ped or player takes in its vehicle.
- [removePedFromVehicle (Shared)](https://wiki.mymp.gg/en/removePedFromVehicle.md): Takes a ped or player out of its vehicle at once, with no animation.
