Squirrel/Client/Functions/Vehicles/Gear
From Liberty Unleashed Wiki
(Difference between revisions)
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( | + | function onPlayerCommand( szCommand, szText ) |
{ | { | ||
if ( szCommand == "gear" ) | if ( szCommand == "gear" ) | ||
{ | { | ||
− | if ( pPlayer.Vehicle ) | + | local pPlayer = FindLocalPlayer(); |
+ | if ( pPlayer.Vehicle ) Message( "Current vehicle gear: " + pPlayer.Vehicle.Gear); | ||
} | } | ||
Line 26: | Line 27: | ||
=== Notes === | === Notes === | ||
− | The | + | 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. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
== Related Functions == | == Related Functions == | ||
− | {{Squirrel/ | + | {{Squirrel/Client/Functions/Vehicles}} |
Revision as of 01:13, 17 August 2011
This Vehicle class member returns the gear of the vehicle.
Syntax
int Vehicle.Gear
Arguments
- none
Example: Returning the value
function onPlayerCommand( szCommand, szText ) { if ( szCommand == "gear" ) { local pPlayer = FindLocalPlayer(); if ( pPlayer.Vehicle ) Message( "Current vehicle gear: " + pPlayer.Vehicle.Gear); } return 1; }
Notes
The functions Message and FindLocalPlayer and event onPlayerCommand were used in this example. More info about them in the corresponding pages.
Related Functions
- FindVehicle
- GetVehicleIDFromName
- GetVehicleName
- Vehicle.Airborne
- Vehicle.Angle
- Vehicle.Colour1
- Vehicle.Colour2
- Vehicle.Driver
- Vehicle.EngineDamage
- Vehicle.EngineState
- Vehicle.Gear
- Vehicle.GetAddon
- Vehicle.Health
- Vehicle.ID
- Vehicle.LightState
- Vehicle.Locked
- Vehicle.Model
- Vehicle.Pos
- Vehicle.Radio
- Vehicle.Siren
- Vehicle.Velocity
- Vehicle.VirtualWorld
- Vehicle.Wrecked