OnClientPedVehicleExit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
{{Client event}}
{{Client event}}
__NOTOC__  
__NOTOC__  
{{New feature/item|3.0159|1.5.8|20740|This event is fired when a [[ped]] has exited a [[vehicle]].}}
{{Added feature/item|3.0159|1.5.9|1.5.8|20740|This event is fired when a [[ped]] has exited a [[vehicle]].}}


==Parameters==  
==Parameters==  
Line 7: Line 7:
vehicle theVehicle, int seat
vehicle theVehicle, int seat
</syntaxhighlight>
</syntaxhighlight>
*'''theVehicle:''' the vehicle that the ped exited.
*'''theVehicle:''' The vehicle that the [[ped]] exited.
*'''seat:''' the number of the seat that the ped was sitting on.
*'''seat:''' The number of the seat that the [[ped]] was sitting on.


==Source==
==Source==
The source of this event is the [[ped]] that exited the vehicle.
The source of this event is the [[ped]] that exited the [[vehicle]].


==Example==  
==Example==  
This example will immediately delete any vehicle a ped exits if the vehicle's health is below 500.
This example will immediately delete any vehicle a ped exits if the vehicle's health is below 500:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function deleteVehicleOnExit(theVehicle, seat)
function deleteVehicleOnExit (theVehicle, seat)
     local vehHealth = getElementHealth(theVehicle)
     local vehHealth = getElementHealth (theVehicle)
     if (vehHealth < 500) then
     if vehHealth < 500 then
         destroyElement(theVehicle)
         destroyElement(theVehicle)
     end
     end
end
end
addEventHandler("onClientPedVehicleExit", root, deleteVehicleOnExit)
 
addEventHandler ("onClientPedVehicleExit", root, deleteVehicleOnExit)
</syntaxhighlight>
</syntaxhighlight>
==Requirements==
{{Requirements|n/a|1.5.8-9.20740}}


==See Also==
==See Also==
===Client ped events===
===Client ped events===
{{Client_ped_events}}
{{Client_ped_events}}
===Client ped functions===
===Client ped functions===
{{Client_ped_functions}}
{{Client_ped_functions}}

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

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

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 client="1.5.8-9.20740" />

See Also

Client ped events


Client ped functions