Squirrel/Server/Functions/Vehicles/Driver

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(fixed some possible dodgy possibilities (like driver: null))
m (Updated used funcs list)
 
Line 33: Line 33:
 
=== Notes ===
 
=== Notes ===
  
The functions [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and [[Squirrel/Server/Functions/Vehicles/FindVehicle|FindVehicle]] and event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
+
The functions [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]], [[Squirrel/Server/Functions/Players/Vehicle|Player.Vehicle]] and event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Vehicles}}
 
{{Squirrel/Server/Functions/Vehicles}}

Latest revision as of 19:01, 29 September 2010

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

This Vehicle class member returns a pointer to the vehicle driver, or if the vehicle has no driver, null.

[edit] Syntax

  1. Player Vehicle.Driver

[edit] Arguments

  • none

[edit] Example

This example command returns who is driving the vehicle when a player types '/driver'.

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "driver" )
  5. {
  6. local pVehicle = pPlayer.Vehicle;
  7. if ( pVehicle )
  8. {
  9. local pDriver = pVehicle.Driver;
  10. if ( pDriver ) MessagePlayer( "Vehicle Driver: " + pDriver.Name, pPlayer );
  11. }
  12. }
  13. return 1;
  14. }
  15.  

[edit] Notes

The functions MessagePlayer, Player.Vehicle and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox