Squirrel/Server/Functions/Vehicles/GetPassenger

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example)
(Example)
Line 17: Line 17:
 
{
 
{
 
local pVehicle = FindVehicle( 0 );
 
local pVehicle = FindVehicle( 0 );
if ( pVehicle ) MessagePlayer( "Vehicle ID (0) Driver: " + pVehicle.Passenger, pPlayer );
+
if ( pVehicle ) MessagePlayer( "Vehicle ID (0) Passenger in Seat ID 1: " + pVehicle.GetPassenger( 1 ), pPlayer );
 
}
 
}
 
 

Revision as of 18:10, 29 September 2010

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

This Vehicle class method will return the passenger pointer for the given seat. If the seat has no passenger, a null pointer will be returned.

Syntax

  1. Player Vehicle.GetPassenger( int seat )

Arguments

  • seat - The seat you wish to return the passenger for. seat is an integer from 0 to 7, 0 being the driver's seat.

Example

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "passenger" )
  5. {
  6. local pVehicle = FindVehicle( 0 );
  7. if ( pVehicle ) MessagePlayer( "Vehicle ID (0) Passenger in Seat ID 1: " + pVehicle.GetPassenger( 1 ), pPlayer );
  8. }
  9. return 1;
  10. }
  11.  

Notes

The functions MessagePlayer and FindVehicle 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