OnClientVehicleExit: Difference between revisions
Jump to navigation
Jump to search
Zangomangu (talk | contribs) mNo edit summary |
m (→Example) |
||
Line 19: | Line 19: | ||
addEventHandler("onClientVehicleEnter", getRootElement(), | addEventHandler("onClientVehicleEnter", getRootElement(), | ||
function(thePlayer, seat) | function(thePlayer, seat) | ||
if thePlayer == | if thePlayer == localPlayer then | ||
guiSetText(lblVehicle, "Currently in a " .. getVehicleName(source)) | guiSetText(lblVehicle, "Currently in a " .. getVehicleName(source)) | ||
end | end | ||
Line 27: | Line 27: | ||
addEventHandler("onClientVehicleExit", getRootElement(), | addEventHandler("onClientVehicleExit", getRootElement(), | ||
function(thePlayer, seat) | function(thePlayer, seat) | ||
if thePlayer == | if thePlayer == localPlayer then | ||
guiSetText(lblVehicle, "Currently on foot") | guiSetText(lblVehicle, "Currently on foot") | ||
end | end |
Latest revision as of 14:24, 31 August 2023
This event gets fired when a ped or player gets out of a vehicle.
Parameters
ped thePed, int seat
- thePed: 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 ped 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 == localPlayer then guiSetText(lblVehicle, "Currently in a " .. getVehicleName(source)) end end ) addEventHandler("onClientVehicleExit", getRootElement(), function(thePlayer, seat) if thePlayer == localPlayer then guiSetText(lblVehicle, "Currently on foot") end end )
See Also
Client vehicle events
- onClientTrailerAttach
- onClientTrailerDetach
- onClientVehicleCollision
- onClientVehicleDamage
- onClientVehicleEnter
- onClientVehicleExit
- onClientVehicleExplode
- onClientVehicleNitroStateChange
- onClientVehicleRespawn
- onClientVehicleStartEnter
- onClientVehicleStartExit
- onClientVehicleWeaponHit