Squirrel/Server/Events/Vehicle/onPlayerExitingVehicle
From Liberty Unleashed Wiki
(Difference between revisions)
m (→Notes) |
|||
Line 1: | Line 1: | ||
− | + | {{Squirrel/Title|onPlayerExitingVehicle}} | |
− | This is called when a player | + | This is called when a player attempts to exit a vehicle. |
== Syntax == | == Syntax == | ||
− | <code>function | + | <code>function onPlayerExitingVehicle( Plyer player, Vehicle vehicle )</code> |
− | == | + | === Arguments === |
− | * '''player''' - The player | + | * '''player''' - The player who is trying to exit the vehicle |
* '''vehicle''' - The vehicle the player is exiting | * '''vehicle''' - The vehicle the player is exiting | ||
− | * ''' | + | |
+ | === Returns === | ||
+ | |||
+ | * '''1''' - Allows the player to exit the vehicle normally | ||
+ | * '''0''' - Locks the player in | ||
== Example == | == Example == | ||
− | This example will | + | This example will stop the player from exiting the vehicle. |
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function | + | function onPlayerExitingVehicle( player, vehicle ) |
{ | { | ||
− | MessagePlayer( " | + | MessagePlayer( "Oh noes! Seems the vehicle doors have malfunctioned", player ); |
+ | |||
+ | return 0; | ||
} | } | ||
</code> | </code> | ||
Line 25: | Line 31: | ||
=== Notes === | === Notes === | ||
− | The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] was used | + | The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] was used in this example. More info about it can be found in the corresponding page. |
== Related Events == | == Related Events == | ||
{{Squirrel/Server/Events/Vehicle}} | {{Squirrel/Server/Events/Vehicle}} |
Revision as of 17:32, 8 November 2010
This is called when a player attempts to exit a vehicle.
Syntax
function onPlayerExitingVehicle( Plyer player, Vehicle vehicle )
Arguments
- player - The player who is trying to exit the vehicle
- vehicle - The vehicle the player is exiting
Returns
- 1 - Allows the player to exit the vehicle normally
- 0 - Locks the player in
Example
This example will stop the player from exiting the vehicle.
function onPlayerExitingVehicle( player, vehicle ) { MessagePlayer( "Oh noes! Seems the vehicle doors have malfunctioned", player ); return 0; }
Notes
The function MessagePlayer was used in this example. More info about it can be found in the corresponding page.