getVehicleCurrentGear | Multi Theft Auto: Wiki Skip to content

getVehicleCurrentGear

Client-side
Server-side
Shared

Pair: .gear

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


Gets the specified vehicle's current gear.

Syntax

getVehicleCurrentGear ( )

Code Examples

client

Example of a program that outputs the current gear to the lower, center of the screen

function makeGearGui( )
local sx, sy = guiGetScreenSize()
local wx = 50
local wy = 50
gearLabel = guiCreateLabel(((sx / 2) - wx), (sy - wy), wx, wy, "5", false)
end
makeGearGui()
function onRender()
g_vehicle = getPedOccupiedVehicle(localPlayer)
if g_vehicle then
g_curGear = tostring(getVehicleCurrentGear(g_vehicle))
guiSetText(gearLabel, g_curGear)
else
guiSetText(gearLabel, "")
end
end
addEventHandler("onClientRender", root, onRender)

See Also

Vehicle Functions