M MY Multiplayer: Wiki
Side
Kind

warpPedIntoVehicle

Shared

Puts a ped or player straight into a vehicle seat, with no animation.

bool warpPedIntoVehicle(ped ped, vehicle vehicle [, int seat = 0])

Parameters

NameTypeDescription
pedpedThe ped or player.
vehiclevehicleThe vehicle.
seatintThe seat: 0 is the driver, 1 and up the passengers.default 0

Returns

true if the ped was put in. false if the seat does not exist, the ped is dead, the vehicle is wrecked or, on the server, whoever holds the seat is getting in or out.

Whoever was in the seat is removed first. The enter events fire as if the ped had got in. On the server, putting someone in the driver's seat turns the engine on.

Example

addCommandHandler("car", function(player)
    local vehicle = createVehicle("infernus", 2495.0, -1680.0, 13.4)
    warpPedIntoVehicle(player, vehicle)
end)
NoteOn the client it only works with peds and vehicles that client created; server elements raise an error.

See also