Difference between revisions of "OnClientVehicleExit"

From Multi Theft Auto: Wiki
m (See Also for client vehicle events)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Incomplete Event]]
 
 
{{Client event}}
 
{{Client event}}
 
__NOTOC__
 
__NOTOC__
This event gets fired when a player gets out of a vehicle.
+
This event gets fired when a player or ped gets out of a vehicle.
  
 
==Parameters==
 
==Parameters==
Line 8: Line 7:
 
player thePlayer, int seat
 
player thePlayer, int seat
 
</syntaxhighlight>
 
</syntaxhighlight>
*'''thePlayer:''' the player that exited the vehicle
+
*'''thePlayer:''' the [[player]] or [[ped]] element that exited the vehicle
 
*'''seat:''' the number of the seat that the player was sitting on. 0 = driver, higher numbers are passenger seats.
 
*'''seat:''' the number of the seat that the player was sitting on. 0 = driver, higher numbers are passenger seats.
  
Line 25: Line 24:
 
     end
 
     end
 
)
 
)
addEventHandler("OnClientVehicleExit", getRootElement(),
+
 
 +
addEventHandler("onClientVehicleExit", getRootElement(),
 
     function(thePlayer, seat)
 
     function(thePlayer, seat)
 
         if thePlayer == getLocalPlayer() then
 
         if thePlayer == getLocalPlayer() then
Line 39: Line 39:
 
===Client event functions===
 
===Client event functions===
 
{{Client_event_functions}}
 
{{Client_event_functions}}
 +
[[es:onClientVehicleExit]]

Latest revision as of 23:11, 30 December 2019

This event gets fired when a player or ped gets out of a vehicle.

Parameters

player thePlayer, int seat
  • thePlayer: the player or ped element that exited the vehicle
  • seat: the number of the seat that the player was sitting on. 0 = driver, higher numbers are passenger seats.

Source

The source of the event is the vehicle that the player exited.

Example

This code updates a GUI label with the name of the vehicle the local player is in.

lblVehicle = guiCreateLabel(10, 200, 150, 20, "Currently on foot", false)
addEventHandler("onClientVehicleEnter", getRootElement(),
    function(thePlayer, seat)
        if thePlayer == getLocalPlayer() then
            guiSetText(lblVehicle, "Currently in a " .. getVehicleName(source))
        end
    end
)

addEventHandler("onClientVehicleExit", getRootElement(),
    function(thePlayer, seat)
        if thePlayer == getLocalPlayer() then
            guiSetText(lblVehicle, "Currently on foot")
        end
    end
)

See Also

Client vehicle events


Client event functions