GetPlayerOccupiedVehicle: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 11: Line 11:
==Example==
==Example==
  if ( vehicle = [[getPlayerOccupiedVehicle]] ( [[findPlayer]] ( "Someguy" ) ) )
  if ( vehicle = [[getPlayerOccupiedVehicle]] ( [[findPlayer]] ( "Someguy" ) ) )
   [[serverchat]] ( "Someguy is in a vehicle with ", [[getVehicleHealth]] ( vehicle ), " health." )
   [[serverChat]] ( "Someguy is in a vehicle with ", [[getVehicleHealth]] ( vehicle ), " health." )
  else
  else
   [[serverchat]] ( "Someguy is not in a vehicle." )
   [[serverChat]] ( "Someguy is not in a vehicle." )
  end
  end

Revision as of 07:29, 28 March 2006

Description

This function returns a vehicle that the player is currently in, if any. This function returns false if the player is on foot, or the player doesn't exist.

Syntax

vehicle getPlayerOccupiedVehicle ( player player )

Required Arguments

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

Example

if ( vehicle = getPlayerOccupiedVehicle ( findPlayer ( "Someguy" ) ) )
  serverChat ( "Someguy is in a vehicle with ", getVehicleHealth ( vehicle ), " health." )
else
  serverChat ( "Someguy is not in a vehicle." )
end