Squirrel/Server/Functions/Players/EnterVehicle

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example)
(Example)
Line 17: Line 17:
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function onPlayerCommand( player, szCommand, szText )
+
-- todo
{
+
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>
  

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. -- todo
  3.  

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