SetVehicleHandling: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:
This function can set a vehicle's handling.<br>
This function can set a vehicle's handling.<br>


''*'''Note:''' This function is still not implemented into the nightly, and currently only impelemented in the handling branch''
''*'''Note:''' This function is still not implemented in the nightly, and is currently only implemented in the handling branch!''


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setVehicleHandling(element theVehicle, string prop int/float/bool value)  
bool setVehicleHandling(element theVehicle, string prop int/float/bool/table value)  
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''theVehicle:''' The vehicle you wish to set the handling of
*'''theVehicle:''' The vehicle you wish to set the handling of. - This must be an element.
*'''prop:''' The property you wish to set the handling of the vehicle to
*'''prop:''' The property you wish to set the handling of the vehicle to. - This must be a string
*'''value:''' The value of the property you wish to set the handling of the vehicle to
*'''value:''' The value of the property you wish to set the handling of the vehicle to. This must be an integer, float, boolean or a table.


===Returns===
===Returns===
Line 20: Line 20:
==Example==  
==Example==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- to do
function massChange(me, command, mass)
  veh = getPedOccupiedVehicle(me) -- get the ped's occupied vehicle
  if speed and veh then  -- if the mass is given and has a veh
      setVehicleHandling(veh, "mass", tonumber(mass)) -- set handling
  end
end
 
addCommandHandler("changemass", massChange)
</syntaxhighlight>
</syntaxhighlight>


==See other vehicle functions==
==See other vehicle functions==
{{Vehicle functions}}
{{Vehicle functions}}

Revision as of 19:42, 6 May 2011

This function can set a vehicle's handling.

*Note: This function is still not implemented in the nightly, and is currently only implemented in the handling branch!

Syntax

bool setVehicleHandling(element theVehicle, string prop int/float/bool/table value) 

Required Arguments

  • theVehicle: The vehicle you wish to set the handling of. - This must be an element.
  • prop: The property you wish to set the handling of the vehicle to. - This must be a string
  • value: The value of the property you wish to set the handling of the vehicle to. This must be an integer, float, boolean or a table.

Returns

Returns true if the handling was set successfully, false otherwise.

Example

function massChange(me, command, mass)
   veh = getPedOccupiedVehicle(me) -- get the ped's occupied vehicle
   if speed and veh then  -- if the mass is given and has a veh
       setVehicleHandling(veh, "mass", tonumber(mass)) -- set handling
   end
end

addCommandHandler("changemass", massChange)

See other vehicle functions