setVehicleRotorState | Multi Theft Auto: Wiki Skip to content

setVehicleRotorState

Client-side
Server-side
Shared

Pair: getVehicleRotorState

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


Turns the rotor on/off for an plane or helicopter. A vehicle with the rotor turned off cannot hover in the air.

Note

The function should not be confused with setVehicleEngineState .

Syntax

setVehicleRotorState ( )

Code Examples

client

This example code will add a command called '/rotorstart' that will either shut your vehicle's rotors off or start them up again. Do note that once rotors are stopped you will simply fall from the sky.

function rotorStartStop()
-- We need to check if the player is in a vehicle, and whether or not it is a plane or helicopter
local vehicle = getPedOccupiedVehicle(localPlayer)
if (not vehicle or (getVehicleType(vehicle) ~= "Helicopter" and getVehicleType(vehicle) ~= "Plane")) then
outputChatBox("You are not in a plane or helicopter!", 255, 0, 0)
return false
end
-- Set the rotor state depending on previous state and give a message
local rotorState = getVehicleRotorState(vehicle)
if (rotorState) then
setVehicleRotorState(vehicle, false)
outputChatBox("Your vehicle's rotor has been stopped, you will now drop out of the sky!", 255, 0, 0)
else
setVehicleRotorState(vehicle, true)
outputChatBox("Your vehicle's rotor has been started up, fly away!", 0, 255, 0)
end
end
addCommandHandler("rotorstart", rotorStartStop) -- Add our command handler

See Also

Vehicle Functions