SetVehicleRotorState
		
		
		
		
		
		Jump to navigation
		Jump to search
		
		
	
Syntax
bool setVehicleRotorState(vehicle theVehicle, bool state [, bool stopRotor = true ] )
OOP Syntax Help! I don't understand this!
- Method: vehicle:setRotorState(...)
 - Variable: .rotorState
 - Counterpart: getVehicleRotorState
 
Required Arguments
- theVehicle: The vehicle (helicopter or plane) whose rotor you want to toggle.
 - state: The rotor state, which determines whether it should be on (true) or off (false).
 
Optional Arguments
- stopRotor: Specifies whether the rotor should be stopped after being turned off. If false, the rotor will continue spinning at a constant speed (it won't slow down or accelerate). It will also not be able to lift off the ground. You can also use setVehicleRotorSpeed to manage the rotor speed.
 
Returns
Returns true if successful, false otherwise.
Example
Click to collapse [-]
ClientThis 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
- areVehicleLightsOn
 - getHeliBladeCollisionsEnabled
 - getVehicleAdjustableProperty
 - getVehicleComponentPosition
 - getVehicleComponentRotation
 - getVehicleComponents
 - getVehicleComponentScale
 - getVehicleComponentVisible
 - getVehicleCurrentGear
 - getVehicleDummyPosition
 - getVehicleGravity
 - getVehicleLandingGearDown
 - getVehicleModelDummyDefaultPosition
 - getVehicleModelDummyPosition
 - getVehicleModelExhaustFumesPosition
 - getVehicleModelWheelSize
 - getVehicleNitroCount
 - getVehicleNitroLevel
 - getVehicleWheelFrictionState
 - getVehicleWheelScale
 - isTrainChainEngine
 - isVehicleNitroActivated
 - isVehicleNitroRecharging
 - isVehicleOnGround
 - isVehicleWheelOnGround
 - isVehicleWindowOpen
 - resetVehicleComponentPosition
 - resetVehicleComponentRotation
 - resetVehicleComponentScale
 - resetVehicleDummyPositions
 - setHeliBladeCollisionsEnabled
 - setVehicleAdjustableProperty
 - setVehicleComponentPosition
 - setVehicleComponentRotation
 - setVehicleComponentScale
 - setVehicleComponentVisible
 - setVehicleDummyPosition
 - setVehicleGravity
 - setVehicleLandingGearDown
 - setVehicleModelDummyPosition
 - setVehicleModelExhaustFumesPosition
 - setVehicleModelWheelSize
 - setVehicleNitroCount
 - setVehicleNitroLevel
 - setVehicleWheelScale
 - setVehicleWheelStates
 - setVehicleWindowOpen
 - Shared
 - addVehicleUpgrade
 - addVehicleSirens
 - attachTrailerToVehicle
 - blowVehicle
 - createVehicle
 - detachTrailerFromVehicle
 - fixVehicle
 - getOriginalHandling
 - getTrainDirection
 - getTrainPosition
 - getTrainSpeed
 - getVehicleColor
 - getVehicleCompatibleUpgrades
 - getVehicleController
 - getVehicleDoorOpenRatio
 - getVehicleDoorState
 - getVehicleEngineState
 - getVehicleHandling
 - getVehicleHeadLightColor
 - getVehicleLandingGearDown
 - getVehicleLightState
 - getVehicleMaxPassengers
 - getVehicleModelFromName
 - getVehicleName
 - getVehicleNameFromModel
 - setVehicleNitroActivated
 - getVehicleOccupant
 - getVehicleOccupants
 - getVehicleOverrideLights
 - getVehiclePaintjob
 - getVehiclePanelState
 - getVehiclePlateText
 - getVehicleSirenParams
 - getVehicleSirens
 - getVehicleSirensOn
 - getVehicleTowedByVehicle
 - getVehicleTowingVehicle
 - getVehicleTurretPosition
 - getVehicleType
 - getVehicleUpgradeOnSlot
 - getVehicleUpgradeSlotName
 - getVehicleUpgrades
 - getVehicleVariant
 - getVehicleWheelStates
 - isTrainDerailable
 - isTrainDerailed
 - isVehicleBlown
 - isVehicleDamageProof
 - isVehicleFuelTankExplodable
 - isVehicleLocked
 - isVehicleOnGround
 - isVehicleTaxiLightOn
 - removeVehicleUpgrade
 - removeVehicleSirens
 - setTrainDerailable
 - setTrainDerailed
 - setTrainDirection
 - setTrainPosition
 - setTrainSpeed
 - setVehicleColor
 - setVehicleDamageProof
 - setVehicleDoorOpenRatio
 - setVehicleDoorState
 - setVehicleDoorsUndamageable
 - setVehicleEngineState
 - setVehicleFuelTankExplodable
 - setVehicleHandling
 - setVehicleHeadLightColor
 - setVehicleLandingGearDown
 - setVehicleLightState
 - setVehicleLocked
 - setVehicleOverrideLights
 - setVehiclePaintjob
 - setVehiclePanelState
 - setVehiclePlateText
 - setVehicleSirens
 - setVehicleSirensOn
 - setVehicleTaxiLightOn
 - setVehicleTurretPosition
 - setVehicleVariant
 - setVehicleWheelStates