OnClientVehicleEnter: Difference between revisions
Jump to navigation
Jump to search
m (See Also for client vehicle events) |
OpenIDUser32 (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{Client event}} | {{Client event}} | ||
__NOTOC__ | __NOTOC__ |
Revision as of 11:06, 21 November 2011
This event gets fired when a player enters a vehicle.
Parameters
player thePlayer, int seat
- thePlayer: the player that entered the vehicle
- seat: the number of the seat that the player is now sitting on. 0 = driver, higher numbers are passenger seats.
Source
The source of the event is the vehicle that the player entered.
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
- onClientTrailerAttach
- onClientTrailerDetach
- onClientVehicleCollision
- onClientVehicleDamage
- onClientVehicleEnter
- onClientVehicleExit
- onClientVehicleExplode
- onClientVehicleNitroStateChange
- onClientVehicleRespawn
- onClientVehicleStartEnter
- onClientVehicleStartExit
- onClientVehicleWeaponHit
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled