Vehicle.Driver

From Liberty Unleashed Wiki
Revision as of 19:01, 29 September 2010 by Juppi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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.

Syntax

  1. Player Vehicle.Driver

Arguments

  • none

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.  

Notes

The functions MessagePlayer, Player.Vehicle 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