SetVehicleRotorSpeed: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ {{Client function}} Sets the rotor speed of a helicopter or plane. This function now applies to both helicopters and planes. {{Note|Setting higher values will cause problems to the client}} ==Syntax== <syntaxhighlight lang="lua"> bool setVehicleRotorSpeed ( vehicle theVehicle, float speed ) </syntaxhighlight> {{OOP||vehicle:setVehicleRotorSpeed|vehicleRotorSpeed|getVehicleRotorSpeed}} ===Required Arguments=== *'''theVehicle:''' the vehicle (helicopter or...") |
m (Prettified example code) |
||
Line 22: | Line 22: | ||
<section name="Client" class="client" show="true"> | <section name="Client" class="client" show="true"> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function | addCommandHandler("rs", function() | ||
local theVehicle = getPedOccupiedVehicle(localPlayer) | |||
if not theVehicle then return end | |||
local controller = getVehicleController(theVehicle) | |||
if controller ~= localPlayer then return end | |||
local vehicleType = getVehicleType(theVehicle) | |||
if vehicleType ~= "Helicopter" and vehicleType ~= "Plane" then return end | |||
setVehicleRotorSpeed(theVehicle, 10) | |||
end) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> | ||
==See Also== | ==See Also== | ||
{{Client vehicle functions}} | {{Client vehicle functions}} |
Latest revision as of 14:50, 23 December 2023
Sets the rotor speed of a helicopter or plane. This function now applies to both helicopters and planes.
Syntax
bool setVehicleRotorSpeed ( vehicle theVehicle, float speed )
OOP Syntax Help! I don't understand this!
- Method: vehicle:setVehicleRotorSpeed(...)
- Variable: .vehicleRotorSpeed
- Counterpart: getVehicleRotorSpeed
Required Arguments
- theVehicle: the vehicle (helicopter or plane) to adjust the rotor of.
- speed: the new rotor speed. Usual values are 0 if the vehicle is stationary, or 0.2 if the rotor is fully spun up. Higher values than normal will not affect the vehicle's handling. Negative values are allowed and will make the rotor spin in the opposite direction (for helicopters, this pushes it down).
Returns
Returns true if successful, false otherwise.
Example
This example changes the rotor speed of the vehicle the player is in, if it's a helicopter or plane.
Click to collapse [-]
ClientaddCommandHandler("rs", function() local theVehicle = getPedOccupiedVehicle(localPlayer) if not theVehicle then return end local controller = getVehicleController(theVehicle) if controller ~= localPlayer then return end local vehicleType = getVehicleType(theVehicle) if vehicleType ~= "Helicopter" and vehicleType ~= "Plane" then return end setVehicleRotorSpeed(theVehicle, 10) end)
See Also
- areVehicleLightsOn
- getHeliBladeCollisionsEnabled
- getHelicopterRotorSpeed
- 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
- setHelicopterRotorSpeed
- setVehicleAdjustableProperty
- setVehicleComponentPosition
- setVehicleComponentRotation
- setVehicleComponentScale
- setVehicleComponentVisible
- setVehicleDummyPosition
- setVehicleGravity
- setVehicleLandingGearDown
- setVehicleModelDummyPosition
- setVehicleModelExhaustFumesPosition
- setVehicleModelWheelSize
- setVehicleNitroActivated
- setVehicleNitroCount
- setVehicleNitroLevel
- setVehicleWheelScale
- setVehicleWheelStates
- setVehicleWindowOpen
- Shared
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- 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
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates