Page tree
Skip to end of metadata
Go to start of metadata



Introduced in

Version:1.31

Description

Description:Returns the gear a vehicle is currently in.

For vehicles that do not have selectable gears implemented (no complexGearbox class defined), the returned gear is calculated, based on the RPM, and returns: 0: reverse, 1: neutral, 2: first forward gear, and so on.

For vehicles that have selectable gears, negative values are reverse, 0 are neutral, and positive are forward gears. For example, -2: 2nd Reverse, -1: 1st Reverse, 0: neutral, 1: 1st Forward, 2: 2nd Forward, and so on (the range depends on what is defined for the specific vehicle).

Syntax

Syntax:getGear vehicle
Parameters:
  • vehicle: Object - Vehicle to check.
Return Value:Number - Current gear.

Alternative Syntax

Syntax:getGear [vehicle, mode] (V1.68+ and V2.08+)
Parameters:
  • vehicle: Object - Vehicle to check.
  • mode: String - Gear information to return. Can be:
    • "SHIFT": Returns a manually selected gear.
    • "GEAR": Returns the gear used by the gearbox. It should differ from shifted gear for semi-automatic gearboxes. For example, if you shift into 5th gear from 2nd gear, this mode returns 2.
    • "TRANS": Returns the transmission gear - 0 means 1st transmission gear, 1 means 2nd transmission gear, and so on. If the vehicle is not using a transmission gearbox, it always returns 0, as if it had just one gear ratio (1:1).
Return Value:Number - Gear information as specified in mode.

Examples

Examples:
_gear = getGear car1
_selected = getGear [car1,"SHIFT"]

Additional Information

See also: setGear, getRpm
Multiplayer: 
Problems: 

Notes