From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This event is triggered when a ped leaves a vehicle.


vehicle theVehicle, int seat, ped jacker, bool forcedByScript
  • theVehicle: A vehicle element representing the vehicle in which the ped exited from.
  • seat: An int representing the seat in which the ped was before exiting.
  • jacker: A player or ped element representing who jacked the driver.
  • forcedByScript: A boolean representing whether the exit was forced using removePedFromVehicle or by the ped.


The source of this event is the ped that left the vehicle.


Destroy the vehicle when ped has been jacked and kick the jacker if exists:

function destroyVehicle (theVehicle, seat, jacker, forcedByScript)
   if seat == 0 then -- If ped was a driver
      if forcedByScript then
         destroyElement (theVehicle) -- If the exit was forced using removePedFromVehicle then destroy the vehicle
      elseif jacker then
         kickPlayer (jacker)
         destroyElement (theVehicle)

addEventHandler ("onPedVehicleExit", root, destroyVehicle)


Minimum server version 1.5.8-9.20740
Minimum client version n/a

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.5.8-9.20740" />

See Also

Ped events

Event functions