IsVehicleOnGround: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(added info about issue #7880 and #8672)
(5 intermediate revisions by 4 users not shown)
Line 7: Line 7:
bool isVehicleOnGround ( vehicle theVehicle )
bool isVehicleOnGround ( vehicle theVehicle )
</syntaxhighlight>  
</syntaxhighlight>  
 
{{OOP||[[vehicle]]:isOnGround|onGround}}
===Required Arguments===  
===Required Arguments===  
*'''theVehicle:''' The vehicle you wish to check.
*'''theVehicle:''' The vehicle you wish to check.


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


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
 
This example does...
This example tells you when you've jumped out of a vehicle.
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
 
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function checkVState ( vehicle, seat, jacked )
blabhalbalhb --abababa
vehName = getVehicleName ( vehicle )
--This line does this...
 
mooo
if isVehicleOnGround ( vehicle ) == false then
outputChatBox ( "You jumped out of a "..vehName.."!", source, 255, 0, 0  )
end
 
end
addEventHandler ( "onPlayerVehicleExit", getRootElement(), checkVState )
</syntaxhighlight>
</syntaxhighlight>
</section>
== Issues ==
{{Issues|
{{Issue|7880|isVehicleOnGround always returns false for Monsters}}
{{Issue|8672|isVehicleOnGround returns false on some vehicles upside down}}
}}


==See Also==
==See Also==
{{Vehicle functions}}
{{Vehicle functions}}
[[Category:Incomplete]] -- leave this unless you complete the function

Revision as of 06:03, 7 July 2015

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

Syntax

bool isVehicleOnGround ( vehicle theVehicle )

OOP Syntax Help! I don't understand this!

Method: vehicle:isOnGround(...)
Variable: .onGround


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.

Click to collapse [-]
Server
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 )

Issues

Issue ID Description
#7880 isVehicleOnGround always returns false for Monsters
#8672 isVehicleOnGround returns false on some vehicles upside down

See Also