setPedEnterVehicle
Client
Makes a ped walk to a vehicle and get in, as if the player pressed the enter key.
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
local car = createVehicle("infernus", 2495.0, -1680.0, 13.4)
local ped = createPed("male01", 2490.0, -1680.0, 13.5)
setPedEnterVehicle(ped, car, 1)