GetVehicleForwardSpeed: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 6: | Line 6: | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|vehicle|The vehicle | {{FuncParam|vehicle|The vehicle identifier}} | ||
{{FuncReturnValue|Returns '''positive''' value if the vehicle is moving forward, otherwise '''negative'''.}} | {{FuncReturnValue|Returns '''positive''' value if the vehicle is moving forward, otherwise '''negative'''.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
local speed = math.tointeger(math.floor(GetVehicleForwardSpeed(GetPlayerVehicle()))) | |||
AddPlayerChat("Speed: "..speed.." km/h") | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
__EDIT_ME__ | __EDIT_ME__ |
Latest revision as of 16:33, 6 August 2020
Description
Returns the vehicle's forward moving speed. Negative when the vehicle is moving backwards.
Syntax
GetVehicleForwardSpeed(vehicle)
Parameters
- vehicle
The vehicle identifier
Return Value
- Returns positive value if the vehicle is moving forward, otherwise negative.
Example
local speed = math.tointeger(math.floor(GetVehicleForwardSpeed(GetPlayerVehicle())))
AddPlayerChat("Speed: "..speed.." km/h")
See also
__EDIT_ME__