GetVehicleCurrentGear: Difference between revisions
Jump to navigation
Jump to search
(Created page with '__NOTOC__ {{Client function}} Gets the specified vehicle's current gear. ==Syntax== <syntaxhighlight lang="lua"> int getVehicleCurrentGear ( vehicle theVehicle ) </syntaxhighlight> ===Required Argume…') |
Cleopatradev (talk | contribs) m (Add OOP definitions) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 8: | Line 8: | ||
int getVehicleCurrentGear ( vehicle theVehicle ) | int getVehicleCurrentGear ( vehicle theVehicle ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[vehicle]]:getGear||.gear}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 19: | Line 20: | ||
Example of a program that outputs the current gear to the lower, center of the screen | Example of a program that outputs the current gear to the lower, center of the screen | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function makeGearGui( ) | |||
local sx, sy = guiGetScreenSize() | |||
local wx = 50 | |||
local wy = 50 | |||
local sx,sy = guiGetScreenSize() | gearLabel = guiCreateLabel(((sx / 2) - wx), (sy - wy), wx, wy, "5", false) | ||
local wx = 50 | end | ||
local wy = 50 | makeGearGui() | ||
gearLabel = guiCreateLabel(((sx/2)-wx),(sy-wy),wx,wy,"5",false) | |||
function onRender() | function onRender() | ||
g_vehicle = getPedOccupiedVehicle( | g_vehicle = getPedOccupiedVehicle(localPlayer) | ||
if g_vehicle then | if g_vehicle then | ||
g_curGear = tostring(getVehicleCurrentGear(g_vehicle)) | g_curGear = tostring(getVehicleCurrentGear(g_vehicle)) | ||
guiSetText(gearLabel,g_curGear) | guiSetText(gearLabel, g_curGear) | ||
else | else | ||
guiSetText(gearLabel,"") | guiSetText(gearLabel, "") | ||
end | end | ||
end | end | ||
addEventHandler("onClientRender", root, onRender) | |||
addEventHandler("onClientRender", | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> |
Latest revision as of 13:31, 1 February 2022
Gets the specified vehicle's current gear.
Syntax
int getVehicleCurrentGear ( vehicle theVehicle )
OOP Syntax Help! I don't understand this!
Required Arguments
- theVehicle: the vehicle to get the gear of
Returns
Returns the gear if successful, false otherwise.
Example
Click to collapse [-]
ClientExample 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
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates