OnClientPedVehicleExit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 19: Line 19:
     local vehHealth = getElementHealth (theVehicle)
     local vehHealth = getElementHealth (theVehicle)
     if vehHealth < 500 then
     if vehHealth < 500 then
         destroyElement(theVehicle)
         destroyElement (theVehicle)
     end
     end
end
end

Revision as of 11:12, 20 September 2021

20740

Parameters

vehicle theVehicle, int seat
  • theVehicle: The vehicle that the ped exited.
  • seat: The number of the seat that the ped was sitting on.

Source

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

Example

This example will immediately delete any vehicle a ped exits if the vehicle's health is below 500:

function deleteVehicleOnExit (theVehicle, seat)
    local vehHealth = getElementHealth (theVehicle)
    if vehHealth < 500 then
        destroyElement (theVehicle)
    end
end

addEventHandler ("onClientPedVehicleExit", root, deleteVehicleOnExit)

Requirements

This template will be deleted.

See Also

Client ped events


Client ped functions