GetVehicleRotorSpeed

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

Retrieves the speed at which the rotor of a helicopter or plane rotates.

Syntax

float getVehicleRotorSpeed ( vehicle theVehicle )

OOP Syntax Help! I don't understand this!

Method: vehicle:getVehicleRotorSpeed(...)
Variable: .vehicleRotorSpeed
Counterpart: setVehicleRotorSpeed


Required Arguments

  • theVehicle: the vehicle element (helicopter or plane) to get the rotor speed of.

Returns

Returns the rotor speed if successful. This is 0 when the helicopter or plane is stationary, and about 0.2 when it is fully spun up. It can be negative if the rotor rotates counter-clockwise. Returns false in case of failure (an invalid element or a vehicle element that is not a helicopter or plane was passed).

Example

This example gets the rotor speed of the vehicle the player is in and outputs it in the chat box 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 
             outputChatBox("Your vehicle rotor speed: "..math.ceil(getVehicleRotorSpeed(theVehicle)),0,255,0)
          end 
       end 
   end 
end
addCommandHandler("grs",rotorSpeed)

See Also