HandlingGetDragCoefficiency: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
Line 18: | Line 18: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function getDragCoefficiency ( player, command ) | |||
local vehicle = getPedOccupiedVehicle(player) | |||
if vehicle then | |||
str = handlingGetDragCoefficiency(getElementModel(vehicle)) | |||
outputChatBox("Your vehicle's handling drag coefficiency is "..str,player,0,255,255) | |||
end | |||
end | |||
addCommandHandler ( "dragcoe", getDragCoefficiency ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Handling_functions}} | {{Handling_functions}} |
Revision as of 15:12, 29 October 2014
Returns the drag coefficient (amount of air resistance) of a handling element or a vehicle ID.
Syntax
float handlingGetDragCoefficiency ( handling theHandling ) float handlingGetDragCoefficiency ( int vehicleID )
Required Arguments
- theHandling: the handling you wish to get the drag coefficient of, or
- vehicleID: the vehicle ID you wish to get the drag coefficient of.
Returns
If you specified a handling element, returns its drag coefficient if one was set, or nil otherwise. If you specified a (valid) vehicle ID, returns the drag coefficient that currently applies to vehicles of that ID. Returns false in case of failure.
Example
function getDragCoefficiency ( player, command ) local vehicle = getPedOccupiedVehicle(player) if vehicle then str = handlingGetDragCoefficiency(getElementModel(vehicle)) outputChatBox("Your vehicle's handling drag coefficiency is "..str,player,0,255,255) end end addCommandHandler ( "dragcoe", getDragCoefficiency )