# setPedEnterVehicle (Client)

> Makes a ped walk to a vehicle and get in, as if the player pressed the enter key.

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

## Syntax

```lua
bool setPedEnterVehicle(ped ped [, vehicle vehicle = nil, int|bool seat = false])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `ped` | `ped` | The ped or player. |
| `vehicle` | `vehicle` | The vehicle. Without it, the ped goes to the closest vehicle it can enter. *(default: `nil`)* |
| `seat` | `int\|bool` | A number picks the seat (`0` is the driver, `1` and up the passengers). `true` gets in as a passenger in the free seat by the nearest door. `false` gets in as the driver. *(default: `false`)* |

## Returns

`true` if the ped started getting in or the request was sent to the server. `false` if the ped is already in a vehicle, is not standing or is dead, if there is no vehicle, if the vehicle is wrecked or cannot be driven, or if the seat does not exist.

## Example

```lua
local car = createVehicle("infernus", 2495.0, -1680.0, 13.4)
local ped = createPed("male01", 2490.0, -1680.0, 13.5)
setPedEnterVehicle(ped, car, 1)
```

## See also

- [setPedExitVehicle (Client)](https://wiki.mymp.gg/en/setPedExitVehicle.md): Makes a ped get out of its vehicle through the door, with the exit animation.
- [warpPedIntoVehicle (Shared)](https://wiki.mymp.gg/en/warpPedIntoVehicle.md): Puts a ped or player straight into a vehicle seat, with no animation.
- [getPedOccupiedVehicle (Shared)](https://wiki.mymp.gg/en/getPedOccupiedVehicle.md): Gets the vehicle a ped or player is in.
- [onClientVehicleStartEnter (Client)](https://wiki.mymp.gg/en/onClientVehicleStartEnter.md): Fired on the client when a ped starts getting into a vehicle. Cancelling the event stops it.
