M MY Multiplayer: Wiki
Side
Kind

onClientVehicleStartEnter

ClientEventCancellable

Fired on the client when a ped starts getting into a vehicle. Cancelling the event stops it.

addEventHandler("onClientVehicleStartEnter", root, function(ped ped, int seat, int door) … end)

Handler parameters

NameTypeDescription
pedpedThe ped or player getting in.
seatintThe seat: 0 is the driver's, 1 onwards the passengers'.
doorintThe door used. For a ped of this client it is SA's door id (10 driver, 8 front passenger, 11 rear on the driver's side, 9 rear on the passenger's side, 18 a bike from the front); for other peds, the index 0 to 4 in the order driver, front passenger, rear driver's side, rear passenger's side, bike.

Source

The vehicle.

Cancelling only works for this client's peds (the local player, the peds it syncs and the ones it created). For other peds the event arrives after the server accepted, and cancelling changes nothing.

Example

addEventHandler("onClientVehicleStartEnter", root, function(ped, seat)
    if ped == localPlayer and seat == 0 and getElementData(source, "policia") then
        cancelEvent()
    end
end)

See also