Squirrel/Server/Events/Vehicle/onPlayerExitingVehicle

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
m (Notes)
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|onPlayerExitingVehicle}}
This is called when a player exits a vehicle, for any reason
+
This is called when a player attempts to exit a vehicle.
  
 
== Syntax ==
 
== Syntax ==
  
<code>function onPlayerExitVehicle( player, vehicle, isPassenger )</code>
+
<code>function onPlayerExitingVehicle( Plyer player, Vehicle vehicle )</code>
  
== Parameters ==
+
=== Arguments ===
  
* '''player''' - The player pointer
+
* '''player''' - The player who is trying to exit the vehicle
 
* '''vehicle''' - The vehicle the player is exiting
 
* '''vehicle''' - The vehicle the player is exiting
* '''isPassenger''' - A boolean which tells whether or not the player was a passenger in the vehicle
+
 
 +
=== Returns ===
 +
 
 +
* '''1''' - Allows the player to exit the vehicle normally
 +
* '''0''' - Locks the player in
  
 
== Example ==
 
== Example ==
  
This example will message the player when they exit a vehicle.
+
This example will stop the player from exiting the vehicle.
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function onPlayerExitVehicle( player, vehicle, isPassenger )
+
function onPlayerExitingVehicle( player, vehicle )
 
{
 
{
     MessagePlayer( "You have exited a " + vehicle + ".", player );
+
     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 in in this example. More info about it can be found in the corresponding page.
+
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

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This is called when a player attempts to exit a vehicle.

Syntax

  1. 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.

  1.  
  2. function onPlayerExitingVehicle( player, vehicle )
  3. {
  4. MessagePlayer( "Oh noes! Seems the vehicle doors have malfunctioned", player );
  5. return 0;
  6. }
  7.  

Notes

The function MessagePlayer was used in this example. More info about it can be found in the corresponding page.

Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox