GetHeliBladeCollisionsEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 20: Line 20:
function onVehicleEnter ( thePlayer, seat, jacked )
function onVehicleEnter ( thePlayer, seat, jacked )
--If the player entered a helicopter
--If the player entered a helicopter
if ( table.find({425,487,488,497,563,447,469},getElementModel(source)) ) then
if ( getVehicleType ( source ) == "Helicopter" ) then
--If the player entered as a driver
--If the player entered as a driver
if ( seat == 0 ) then
if ( seat == 0 ) then
--If blade collisions were off
-- Turn off collisions
if not getHeliBladeCollisionsEnabled( source ) then
setHeliBladeCollisionsEnabled ( source, false )
setHeliBladeCollisionsEnabled( source, true )
else
setHeliBladeCollisionsEnabled( source, false )
end
end
end
end
end

Revision as of 13:10, 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 [-]
Server

This example disables blades collisions when a player enters a helicopter as a driver.

function onVehicleEnter ( thePlayer, seat, jacked )
	--If the player entered a helicopter
	if ( getVehicleType ( source ) == "Helicopter" ) then
		--If the player entered as a driver
		if ( seat == 0 ) then
			-- Turn off collisions
			setHeliBladeCollisionsEnabled ( source, false )
		end
	end
end
addEventHandler ( "onVehicleEnter", root, onVehicleEnter )

See Also