SetVehicleRotorSpeed

From Multi Theft Auto: Wiki
Revision as of 14:50, 23 December 2023 by Tracer (talk | contribs) (Prettified example code)
(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
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)

See Also