GetVehicleForwardSpeed: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|GetVehicleForwardSpeed(vehicle)}} {{FuncParameters}} {{FuncParam|vehicle|__EDIT_ME__}} {{FuncRetu..."
 
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Info|Function|Client|1.0}}
{{Info|Function|Client|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Returns the vehicle's forward moving speed. Negative when the vehicle is moving backwards.}}


{{FuncSyntax|GetVehicleForwardSpeed(vehicle)}}
{{FuncSyntax|GetVehicleForwardSpeed(vehicle)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|vehicle|__EDIT_ME__}}
{{FuncParam|vehicle|The vehicle identifier}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Returns '''positive''' value if the vehicle is moving forward, otherwise '''negative'''.}}


== Example ==
== Example ==
__EDIT_ME__
<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

GetVehicleForwardSpeed

Type: Function
Context: Client
Introduced: v1.0

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__