OnVehicleStartExit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
[[Category:Incomplete Event]]
__NOTOC__  
__NOTOC__  
This event is triggered when a player starts to leave a vehicle. It can be used to cancel the exit and cause the player to remain in the vehicle, if necessary.
{{Server event}}
This event is triggered when a player starts to exit a vehicle. This event can be used to cancel exit, if necessary.


==Syntax==  
==Parameters==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
void onVehicleStartExit ( player player, int seat, player jacker )
player exitingPlayer, int seat, player jacked
</syntaxhighlight>  
</syntaxhighlight>  
*'''enteringPlayer''': 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
==Source==
The [[event system#Event source|source]] of this event is the [[vehicle]] in which a player began to exit.


===Canceling===
===Canceling===
If this event is [[Event system #Canceling|canceled]], the player will not exit a vehicle.
If this event is [[Event system #Canceling|canceled]], the player will not exit the vehicle.


==Example==  
==Example==  
This example does...
This example locks a player inside a police vehicle if he is a policeman.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
policeVehicles { [598]=true,[596]=true,[597]=true,[599]=true }
blabhalbalhb --abababa
policeSkins { [280]=true,[281]=true,[282]=true,[283]=true,[284]=true,[285]=true,[286]=true }
--This line does this...
 
mooo
function exitVehicle ( player, seat, jacked ) --when a player enters a vehicle
    if ( policeVehicles[getVehicleID(source)] ) and ( policeSkins[getPlayerSkin(player)] ) 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!", player ) --and tell the player why
    end
end
addEventHandler ( "onVehicleStartExit", getRootElement(), exitVehicle ) --add an event for onPlayerEnterVehicle
</syntaxhighlight>
</syntaxhighlight>
==See Also==
{{Event_functions}}

Revision as of 06:07, 30 December 2007

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
  • enteringPlayer: 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

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 ( player, seat, jacked ) --when a player enters a vehicle
    if ( policeVehicles[getVehicleID(source)] ) and ( policeSkins[getPlayerSkin(player)] ) 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!", player ) --and tell the player why
    end
end
addEventHandler ( "onVehicleStartExit", getRootElement(), exitVehicle ) --add an event for onPlayerEnterVehicle

See Also