GetHelicopterRotorSpeed: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
{{deprecated|getVehicleRotorSpeed}}
Retrieves the speed at which the rotor of a helicopter rotates.
Retrieves the speed at which the rotor of a helicopter rotates.


Line 7: Line 8:
float getHelicopterRotorSpeed ( vehicle heli )
float getHelicopterRotorSpeed ( vehicle heli )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[vehicle]]:getHelicopterRotorSpeed|helicopterRotorSpeed|setHelicopterRotorSpeed}}


===Required Arguments===
===Required Arguments===
*'''heli:''' the helicopter element to change the rotor speed of.
*'''heli:''' the helicopter element to get the rotor speed of.


===Returns===
===Returns===
Returns the rotor speed if successful. This is 0 when the helicopter is parked, and about 0.2 when it is fully spun up. Returns ''false'' in case of failure (an invalid element or a vehicle element that is not a helicopter was passed).
Returns the rotor speed if successful. This is 0 when the helicopter is parked, 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 was passed).
 
==Example==
This example gets the helicopter roto speed and outputs it in the chat box.
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
function rotorSpeed()
    local theVehicle = getPedOccupiedVehicle (localPlayer)
    if theVehicle then
      local controller = getVehicleController (theVehicle)
        if controller == localPlayer then
          local vehecileType = getVehicleType(theVehicle)
  if vehecileType == "Helicopter" then
            outputChatBox("You helicopter roto speed "..math.ceil(getHelicopterRotorSpeed(theVehicle)),0,255,0)
          end
      end
  end
end
addCommandHandler("grs",rotorSpeed)
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Client vehicle functions}}
{{Client vehicle functions}}

Latest revision as of 23:17, 13 October 2024

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use getVehicleRotorSpeed instead.

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

Syntax

float getHelicopterRotorSpeed ( vehicle heli )

OOP Syntax Help! I don't understand this!

Method: vehicle:getHelicopterRotorSpeed(...)
Variable: .helicopterRotorSpeed
Counterpart: setHelicopterRotorSpeed


Required Arguments

  • heli: the helicopter element to get the rotor speed of.

Returns

Returns the rotor speed if successful. This is 0 when the helicopter is parked, 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 was passed).

Example

This example gets the helicopter roto speed and outputs it in the chat box.

Click to collapse [-]
Client
function rotorSpeed() 
    local theVehicle = getPedOccupiedVehicle (localPlayer)
    if theVehicle then 
      local controller = getVehicleController (theVehicle)
        if controller == localPlayer then 
          local vehecileType = getVehicleType(theVehicle)
	  if vehecileType == "Helicopter" then 
             outputChatBox("You helicopter roto speed "..math.ceil(getHelicopterRotorSpeed(theVehicle)),0,255,0)
          end 
       end 
   end 
end
addCommandHandler("grs",rotorSpeed)

See Also