Squirrel/Server/Functions/Players/EnterVehicle

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|Player.EnterVehicle}} {{ScriptingChangesIn0.1.0.9}} This ''Player'' class function will force the player to enter a vehicle with the entering animation. Note tha…')
 
(Example)
Line 17: Line 17:
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( player, szCommand, szText )
 +
{
 +
if ( szCommand == "runaway" )
 +
{
 +
local v = pPlayer.Pos;
 +
local veh = createVehicle( 90, v.x, v.y, v.z, pPlayer.Angle );
 +
if ( veh )
 +
{
 +
MessagePlayer( "Warping you to the vehicle!", player );
 +
player.EnterVehicle( veh, DOOR_DRIVER );
 +
}
 +
}
 +
return 1;
 +
}
 
</code>
 
</code>
  
 
=== Notes ===
 
=== Notes ===
  
-- List of used functions and other notes here.
+
The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in this example. More info about this in the corresponding page.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Players}}
 
{{Squirrel/Server/Functions/Players}}

Revision as of 08:36, 3 February 2013

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

This Player class function will force the player to enter a vehicle with the entering animation. Note that the vehicle must be spawned for that player and within a 10 metres radius of them.

Syntax

  1. bool Player.EnterVehicle( Vehicle vehicle, int door )

Arguments

  • vehicle - The vehicle this player should enter
  • door - The door to use

Example

Some explanation here

This function needs an example. You can help us complete the wiki by writing one, or maybe even more :o
  1.  
  2. function onPlayerCommand( player, szCommand, szText )
  3. {
  4. if ( szCommand == "runaway" )
  5. {
  6. local v = pPlayer.Pos;
  7. local veh = createVehicle( 90, v.x, v.y, v.z, pPlayer.Angle );
  8. if ( veh )
  9. {
  10. MessagePlayer( "Warping you to the vehicle!", player );
  11. player.EnterVehicle( veh, DOOR_DRIVER );
  12. }
  13. }
  14. return 1;
  15. }
  16.  

Notes

The function MessagePlayer and event onPlayerCommand was used in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox