Scripting/Squirrel/Functions/Players/IsPassenger

From VC-MP Wiki

Jump to: navigation, search

This instance variable returns whether player is a passenger in a car or not.

Syntax

bool player.IsPassenger

Example

This command tells the player whether they are a passenger in a vehicle or not when they type '/c passenger'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "passenger" )
     {
          if ( player.IsPassenger ) MessagePlayer( "You are curently a passenger in a vehicle.", player );
          else MessagePlayer( "You aren't curently a passenger in any vehicle.", player );
     }
}

Notes

The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Related Functions

Personal tools
squirrel scripting