OnVehicleStartExit: Difference between revisions
Jump to navigation
Jump to search
m (→Example) |
(Introduced the new event parameter: door) |
||
Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
player exitingPlayer, int seat, player jacked | player exitingPlayer, int seat, player jacked, int door | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 11: | Line 11: | ||
*'''seat''': An integer representing the seat in which the player is exiting from | *'''seat''': An integer representing the seat in which the player is exiting from | ||
*'''jacked''': A player element representing who is jacking | *'''jacked''': A player element representing who is jacking | ||
{{New feature|3.0110|1.1| | |||
*'''door''': An integer representing the door that the player is using to leave. | |||
}} | |||
==Source== | ==Source== |
Revision as of 10:49, 8 June 2011
This event is triggered when a player starts to exit a vehicle. This event can be used to cancel exit, if necessary.
Parameters
player exitingPlayer, int seat, player jacked, int door
- exitingPlayer: A player element representing the player who is starting to exit a vehicle
- seat: An integer representing the seat in which the player is exiting from
- jacked: A player element representing who is jacking
- door: An integer representing the door that the player is using to leave.
Source
The source of this event is the vehicle in which a player began to exit.
Canceling
If this event is canceled, the player will not exit the vehicle.
Example
This example locks a player inside a police vehicle if he is a policeman.
policeVehicles { [598]=true,[596]=true,[597]=true,[599]=true } policeSkins { [280]=true,[281]=true,[282]=true,[283]=true,[284]=true,[285]=true,[286]=true } function exitVehicle ( thePlayer, seat, jacked ) --when a player enters a vehicle if ( policeVehicles[getVehicleID ( source )] ) and ( policeSkins[getPlayerSkin ( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is a police skin cancelEvent() outputChatBox ( "You're the cop! Don't exit the car!", thePlayer ) --and tell the player why end end addEventHandler ( "onVehicleStartExit", getRootElement(), exitVehicle ) -- add an event handler for onVehicleStartExit
See Also
Vehicle events
- onTrailerAttach
- onTrailerDetach
- onVehicleDamage
- onVehicleEnter
- onVehicleExit
- onVehicleExplode
- onVehicleRespawn
- onVehicleStartEnter
- onVehicleStartExit
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled