OnPlayerVehicleExit: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Server event}} This event is triggered when a player leaves a vehicle, for whatever reason. ==Parameters== <syntaxhighlight lang="lua"> vehicle theVehicle, int seat, player jacker </syntaxhighlight> ...) |
Zangomangu (talk | contribs) (Updated parameters) |
||
(12 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server event}} | {{Server event}} | ||
This event is triggered when a player leaves a vehicle, for whatever reason. | This event is triggered when a [[player]] leaves a vehicle, for whatever reason. | ||
==Parameters== | ==Parameters== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
vehicle theVehicle, int seat, | vehicle theVehicle, int seat, ped jacker, bool forcedByScript | ||
</syntaxhighlight> | </syntaxhighlight> | ||
*'''theVehicle''': | *'''theVehicle''': a [[vehicle]] element representing the vehicle in which the player exited from. | ||
*'''seat''': | *'''seat''': an [[int]] representing the seat in which the player was before exiting. | ||
*'''jacker''': | *'''jacker''': a [[player]] or [[ped]] element representing who jacked the driver. | ||
{{New feature/item|3.0154|1.5.3|11247| | |||
*'''forcedByScript:''' a [[boolean]] representing whether the exit was forced using [[removePedFromVehicle]] or by the player. | |||
}} | |||
==Source== | ==Source== | ||
The [[event system#Event source|source]] of this event is the [[player]] that | The [[event system#Event source|source]] of this event is the [[player]] that left the vehicle. | ||
==Example== | ==Example== | ||
Line 20: | Line 23: | ||
function addHelmetOnEnter ( vehicle, seat, jacked ) | function addHelmetOnEnter ( vehicle, seat, jacked ) | ||
if ( getVehicleID ( vehicle ) == 522 ) then -- if its a nrg | if ( getVehicleID ( vehicle ) == 522 ) then -- if its a nrg | ||
addPedClothes ( source, "moto", "moto", 16 ) -- add the helmet | |||
end | end | ||
end | end | ||
addEventHandler ( " | addEventHandler ( "onPlayerVehicleEnter", root, addHelmetOnEnter ) | ||
function removeHelmetOnExit ( vehicle, seat, jacked ) | function removeHelmetOnExit ( vehicle, seat, jacked ) | ||
if ( getVehicleID ( vehicle ) == 522 ) then -- if its a nrg | if ( getVehicleID ( vehicle ) == 522 ) then -- if its a nrg | ||
removePedClothes ( source, 16 ) -- remove the helmet | |||
end | end | ||
end | end | ||
addEventHandler ( " | addEventHandler ( "onPlayerVehicleExit", root, removeHelmetOnExit ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | ==Changelog== | ||
{{ | {{ChangelogHeader}} | ||
{{ChangelogItem|1.5.3-9.11247|Added forcedByScript argument}} | |||
{{See also/Server event|Player events}} |
Latest revision as of 22:19, 1 February 2021
This event is triggered when a player leaves a vehicle, for whatever reason.
Parameters
vehicle theVehicle, int seat, ped jacker, bool forcedByScript
- theVehicle: a vehicle element representing the vehicle in which the player exited from.
- seat: an int representing the seat in which the player was before exiting.
- jacker: a player or ped element representing who jacked the driver.
- forcedByScript: a boolean representing whether the exit was forced using removePedFromVehicle or by the player.
Source
The source of this event is the player that left the vehicle.
Example
This example adds a 'moto' helmet to a player when he gets on a nrg bike, and removes it when he gets off.
function addHelmetOnEnter ( vehicle, seat, jacked ) if ( getVehicleID ( vehicle ) == 522 ) then -- if its a nrg addPedClothes ( source, "moto", "moto", 16 ) -- add the helmet end end addEventHandler ( "onPlayerVehicleEnter", root, addHelmetOnEnter ) function removeHelmetOnExit ( vehicle, seat, jacked ) if ( getVehicleID ( vehicle ) == 522 ) then -- if its a nrg removePedClothes ( source, 16 ) -- remove the helmet end end addEventHandler ( "onPlayerVehicleExit", root, removeHelmetOnExit )
Changelog
Version | Description |
---|
1.5.3-9.11247 | Added forcedByScript argument |
See Also
Player events
- onPlayerACInfo
- onPlayerBan
- onPlayerChangeNick
- onPlayerChat
- onPlayerClick
- onPlayerCommand
- onPlayerConnect
- onPlayerContact
- onPlayerDamage
- onPlayerJoin
- onPlayerLogin
- onPlayerLogout
- onPlayerMarkerHit
- onPlayerMarkerLeave
- onPlayerModInfo
- onPlayerMute
- onPlayerNetworkStatus
- onPlayerPickupHit
- onPlayerPickupLeave
- onPlayerPickupUse
- onPlayerPrivateMessage
- onPlayerQuit
- onPlayerScreenShot
- onPlayerSpawn
- onPlayerStealthKill
- onPlayerTarget
- onPlayerUnmute
- onPlayerVehicleEnter
- onPlayerVehicleExit
- onPlayerVoiceStart
- onPlayerVoiceStop
- onPlayerWasted
- onPlayerWeaponFire
- onPlayerWeaponSwitch
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled