GetHeliBladeCollisionsEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 15: Line 15:


==Example==  
==Example==  
<section name="Server" class="server" show="true">
<section name="Client" class="client" show="true">
This example disables blades collisions when a player enters a helicopter as a driver.
This example shows the blade collisions state
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function onVehicleEnter ( thePlayer, seat, jacked )
function onVehicleEnter ( seat, jacked )
--If the player entered a helicopter
--If the player entered a helicopter
if ( getVehicleType ( source ) == "Helicopter" ) then
if ( getVehicleType ( source ) == "Helicopter" ) then
--If the player entered as a driver
local state = getHeliBladeCollisionsEnabled‎(source )
if ( seat == 0 ) then
outputChatBox("Helicopter blades collisions are turned ".. (state and "on" or "off") )
-- Turn off collisions
setHeliBladeCollisionsEnabled ( source, false )
end
end
end
end
end
addEventHandler ( "onVehicleEnter", root, onVehicleEnter )
addEventHandler ( "onClientVehicleEnter", localPlayer, onVehicleEnter )
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Revision as of 13:12, 13 September 2013

This function gets the state of the helicopter blades collisions on the specified vehicle.

Syntax

bool getHeliBladeCollisionsEnabled ( vehicle theVehicle )

Required Arguments

  • theVehicle: The vehicle that will be checked.

Returns

Returns true if the collisions are enabled for specified vehicle, false if the collisions aren't enabled for the specified vehicle, if the vehicle is not a helicopter or if invalid arguments are specified.

Example

Click to collapse [-]
Client

This example shows the blade collisions state

function onVehicleEnter ( seat, jacked )
	--If the player entered a helicopter
	if ( getVehicleType ( source ) == "Helicopter" ) then
		local state = getHeliBladeCollisionsEnabled‎(source )
		outputChatBox("Helicopter blades collisions are turned ".. (state and "on" or "off") )
	end
end
addEventHandler ( "onClientVehicleEnter", localPlayer, onVehicleEnter )

See Also