Squirrel/Client/Functions/Vehicles/Gear

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
m (moved Squirrel/Server/Functions/Vehicles/Gear to Squirrel/Client/Functions/Vehicles/Gear: 99% sure gear isnt transmitted in the netcode so the server wouldnt know)
Line 13: Line 13:
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function onPlayerCommand( pPlayer, szCommand, szText )
+
function onPlayerCommand( szCommand, szText )
 
{
 
{
 
if ( szCommand == "gear" )
 
if ( szCommand == "gear" )
 
{
 
{
if ( pPlayer.Vehicle ) MessagePlayer( "Current vehicle gear: " + pPlayer.Vehicle.Gear, pPlayer );
+
local pPlayer = FindLocalPlayer();
 +
if ( pPlayer.Vehicle ) Message( "Current vehicle gear: " + pPlayer.Vehicle.Gear);
 
}
 
}
 
 
Line 26: Line 27:
 
=== Notes ===
 
=== Notes ===
  
The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
+
The functions [[Squirrel/Client/Functions/Messages/Message|Message]] and [[Squirrel/Client/Functions/Players/FindLocalPlayer |FindLocalPlayer ]] and event [[Squirrel/Client/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
 
+
=== Notes ===
+
 
+
The 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/Vehicles}}
+
{{Squirrel/Client/Functions/Vehicles}}

Revision as of 01:13, 17 August 2011

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

This Vehicle class member returns the gear of the vehicle.

Syntax

  1. int Vehicle.Gear

Arguments

  • none

Example: Returning the value

  1.  
  2. function onPlayerCommand( szCommand, szText )
  3. {
  4. if ( szCommand == "gear" )
  5. {
  6. local pPlayer = FindLocalPlayer();
  7. if ( pPlayer.Vehicle ) Message( "Current vehicle gear: " + pPlayer.Vehicle.Gear);
  8. }
  9. return 1;
  10. }
  11.  

Notes

The functions Message and FindLocalPlayer and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox