OnVehicleStartEnter: Difference between revisions
Jump to navigation
Jump to search
OpenIDUser32 (talk | contribs) No edit summary |
OpenIDUser32 (talk | contribs) No edit summary |
||
Line 9: | Line 9: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | }} | ||
{{New feature/item|3|1.0| | {{New feature/item|3|1.0|| | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
player enteringPlayer, int seat, player jacked, int door | player enteringPlayer, int seat, player jacked, int door |
Revision as of 12:39, 22 November 2011
This event is triggered when a player starts to enter a vehicle. This event can be used to cancel entry, if necessary.
Parameters
player enteringPlayer, int seat, player jacked, int door
- enteringPlayer: A player element representing the player who is starting to enter a vehicle
- seat: An integer representing the seat in which the player is entering
- jacked: A player element representing who is going to be jacked
- door: An integer of which door the player used (0-3). 0 is driver side door, 1 is front passenger, 2 is back left, 3 is back right.
Source
The source of this event is the vehicle in which a player began to enter.
Canceling
If this event is canceled, the player will not enter the vehicle.
Example
This example blocks a player out of a police vehicle if he is not 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 enterVehicle ( player, seat, jacked ) --when a player enters a vehicle if ( policeVehicles[getElementModel(source)] ) and ( not policeSkins[getElementModel(player)] ) then --if the vehicle is one of 4 police cars, and the skin is not a police skin cancelEvent() outputChatBox ( "Only policeman can enter police cars!", player ) --and tell the player why end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) --add an event handler for onVehicleStartEnter
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