SetHelicopterRotorSpeed: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 21: Line 21:
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function rotorSpeed()
function rotorSpeed()  
   if isPedInVehicle(localPlayer) then
   local theVehicle = getPedOccupiedVehicle (localPlayer)
      local theVehicle = getPedOccupiedVehicle (localPlayer)
    if theVehicle then  
      if theVehicle then  
local controller = getVehicleController (theVehicle)
  local controller = getVehicleController (theVehicle)
if controller == localPlayer then  
  if controller == localPlayer then  
  local vehecileType = getVehicleType(theVehicle)
    local vehecileType = getVehicleType(theVehicle)
  if vehecileType == "Helicopter" then  
    if vehecileType == "Helicopter" then  
setHelicopterRotorSpeed (theVehicle,10)
setHelicopterRotorSpeed (theVehicle,10)
    end  
  end  
  end
      end  
      end  
   end  
   end  
end  
end  

Revision as of 21:13, 26 June 2016

Sets the rotor speed of a helicopter.

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

Syntax

bool setHelicopterRotorSpeed ( vehicle heli, float speed )

OOP Syntax Help! I don't understand this!

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


Required Arguments

  • heli: the helicopter to adjust the rotor of.
  • speed: the new rotor speed. Usual values are 0 if the helicopter stands still, or 0.2 if the rotor is fully spun up. Higher values than normal will not affect the helicopter's handling. Negative values are allowed and will make the rotor spin in the opposite direction (pushing the helicopter down).

Returns

Returns true if successful, false otherwise.

Example

This example change the helicopter rotor speed.

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 
		setHelicopterRotorSpeed (theVehicle,10)
	   end 
       end 
   end 
end 
addCommandHandler("rs",rotorSpeed)

See Also