GetVehicleHandling: 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 get a vehicle's handling.<br>
This function can get 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==  
Line 19: Line 19:
This example simplifies the use of getVehicleHandling
This example simplifies the use of getVehicleHandling
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
_getVehicleHandling = getVehicleHandling()
_getVehicleHandling = getVehicleHandling() -- replace the original getVehicleHandling function as _getVehicleHandling
function getVehicleHandling(veh, prop)
function getVehicleHandling(ele, prop)
         if veh then
         if ele and prop then -- there is an element and property
           if getElementType(veh) == "vehicle" then
           if getElementType(ele) == "vehicle" then -- if the type of the element is a vehicle
      local handlingTable = _getVehicleHandling(veh)
      local handlingTable = _getVehicleHandling(ele) -- get the handling as table and save as handlingTable
               local value = handlingTable.prop
               local value = handlingTable.prop -- make the value wanted
               return value
               return value -- return the value wanted!
           end
           end
         end
         end

Revision as of 19:44, 6 May 2011

This function can get a vehicle's handling.

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

Syntax

table getVehicleHandling(element theVehicle) 

Required Arguments

  • theVehicle: The vehicle you wish to get the handling of

Returns

Returns a table, false otherwise.

Example

This example simplifies the use of getVehicleHandling

_getVehicleHandling = getVehicleHandling() -- replace the original getVehicleHandling function as _getVehicleHandling
function getVehicleHandling(ele, prop)
        if ele and prop then -- there is an element and property
           if getElementType(ele) == "vehicle" then -- if the type of the element is a vehicle
	      local handlingTable = _getVehicleHandling(ele) -- get the handling as table and save as handlingTable
              local value = handlingTable.prop -- make the value wanted
              return value -- return the value wanted!
           end
        end
end

See other vehicle functions