# getPedOccupiedVehicle (Shared)

> Gets the vehicle a ped or player is in.

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

## Syntax

```lua
vehicle|false getPedOccupiedVehicle(ped ped)
```

## Parameters

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

## Returns

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

## Example

```lua
addCommandHandler("fix", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    if vehicle then
        fixVehicle(vehicle)
    end
end)
```

## See also

- [getPedOccupiedVehicleSeat (Shared)](https://wiki.mymp.gg/en/getPedOccupiedVehicleSeat.md): Gets the seat a ped or player takes in its vehicle.
- [isPedInVehicle (Shared)](https://wiki.mymp.gg/en/isPedInVehicle.md): Tells whether a ped or player is in a vehicle.
- [warpPedIntoVehicle (Shared)](https://wiki.mymp.gg/en/warpPedIntoVehicle.md): Puts a ped or player straight into a vehicle seat, with no animation.
- [getVehicleOccupant (Shared)](https://wiki.mymp.gg/en/getVehicleOccupant.md): Returns the ped or player sitting in a seat of a vehicle.
