M MY Multiplayer: Wiki
Side
Kind

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

NameTypeDescription
pedpedThe ped or player.
vehiclevehicleThe vehicle. Without it, the ped goes to the closest vehicle it can enter.default nil
seatint|boolA 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)

See also