getVehicleRotorState | Multi Theft Auto: Wiki Skip to content

getVehicleRotorState

Client-side
Server-side
Shared

Pair: setVehicleRotorState

This page is incomplete! Help wanted!

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


This function returns a vehicle's (plane or helicopter) rotor state (on or off).

Note

The function should not be confused with getVehicleEngineState .

Syntax

getVehicleRotorState ( )

Code Examples

client

This code adds a simple command that allows you to check a vehicle's rotor state keeping in mind you have to be in either a plane or helicopter.

function checkRotor()
-- 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
-- And now we show rotor state using a neat ternary expression
local rotorState = getVehicleRotorState(vehicle)
outputChatBox("Your vehicle's rotor is "..(rotorState and "spinning" or "stopped").."!", 0, 255, 0)
end
addCommandHandler("rotor", checkRotor)

See Also

Vehicle Functions