GetPlayerOccupiedVehicle

From Multi Theft Auto: Wiki
Revision as of 11:14, 14 August 2006 by EAi (talk | contribs)
Jump to navigation Jump to search

This function gets the vehicle that the player is currently in, if any.

Syntax

vehicle getPlayerOccupiedVehicle ( player thePlayer )

Required Arguments

  • thePlayer: The player whose vehicle you're looking up.

Returns

Returns the vehicle that the player is in, or false if the player is not in a vehicle or is an invalid player.

Example

This example finds if the player called someguy is in a vehicle, if they it shows the vehicle's health in the chatbox.

if ( vehicle = getPlayerOccupiedVehicle ( findPlayer ( "someguy" ) ) )
  outputChatBox ( "Someguy is in a vehicle with " .. getVehicleHealth ( vehicle ) .. " health." )
else
  outputchatbox ( "Someguy is not in a vehicle." )
end

See Also