Difference between revisions of "IsVehicleOnGround"

From Multi Theft Auto: Wiki
(Example)
Line 15: Line 15:
  
 
==Example==  
 
==Example==  
This page does not have an example.
+
 
 +
This example tells you when you've jumped out of a vehicle.
 +
 
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
--add an example here
+
function checkVState ( vehicle, seat, jacked )
 +
vehName = getVehicleName ( vehicle )
 +
 
 +
if isVehicleOnGround ( vehicle ) == false then
 +
outputChatBox ( "You jumped out of a "..vehName.."!", source, 255, 0, 0  )
 +
end
 +
 
 +
end
 +
addEventHandler ( "onPlayerVehicleExit", getRootElement(), checkVState )
 +
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 16:01, 5 July 2009

Checks to see if a vehicle has contact with the ground.

Syntax

bool isVehicleOnGround ( vehicle theVehicle )

Required Arguments

  • theVehicle: The vehicle you wish to check.

Returns

Returns true if vehicle is on the ground, false if it is not.

Example

This example tells you when you've jumped out of a vehicle.

function checkVState ( vehicle, seat, jacked )
	vehName = getVehicleName ( vehicle )

	if isVehicleOnGround ( vehicle ) == false then
		outputChatBox ( "You jumped out of a "..vehName.."!", source, 255, 0, 0  )
	end

end
addEventHandler ( "onPlayerVehicleExit", getRootElement(), checkVState )

See Also

BETA: FROM VERSION 1.6 r7485 ONWARDS
BETA: FROM VERSION 1.6 r7485 ONWARDS