SetVehicleRotorSpeed

From Multi Theft Auto: Wiki
Revision as of 11:19, 21 December 2023 by Nurupo (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sets the rotor speed of a helicopter or plane. This function now applies to both helicopters and planes.

[[{{{image}}}|link=|]] Note: Setting higher values will cause problems to the client

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 [-]
Client
function rotorSpeed() 
   local theVehicle = getPedOccupiedVehicle (localPlayer)
   if theVehicle then 
      local controller = getVehicleController (theVehicle)
      if controller == localPlayer then 
         local vehicleType = getVehicleType(theVehicle)
         if vehicleType == "Helicopter" or vehicleType == "Plane" then 
            setVehicleRotorSpeed(theVehicle, 10)
         end 
      end 
   end 
end 
addCommandHandler("rs", rotorSpeed)

See Also