SixL client API / game/pad / GamePadMp
Interface: GamePadMp
The control functions: the state of a control and how scripts may disable or enable it.
Remarks
A control is given as a number from the common table of control ids (such as 22 for jump), as a name (such as 'JUMP', with or without the 'INPUT_' prefix) or as its hash. A number outside the table and below 1000 is an error. Pad index 0 is the local player. Getters are asynchronous: they return a Promise.
Example
const jumping = await mp.game.pad.isControlPressed(0, 22);
Methods
disableControlAction()
disableControlAction(padIndex,control,disable):void
Disables a control's action for the game's own handling (it is still readable with the is-pressed functions).
Parameters
padIndex
number
The pad index: 0 for the local player.
control
string | number
The control id, its name or its hash.
disable
boolean
true to disable the control's action, false to enable it again.
Returns
void
Example
mp.game.pad.disableControlAction(0, 22, true);
enableControlAction()
enableControlAction(padIndex,control,enable):void
Enables a control's action again after disableControlAction.
Parameters
padIndex
number
The pad index: 0 for the local player.
control
string | number
The control id, its name or its hash.
enable
boolean
true to enable the control's action, false to keep it disabled.
Returns
void
Example
mp.game.pad.enableControlAction(0, 22, true);
getControlNormal()
getControlNormal(padIndex,control):Promise<number>
The normalised value of a control, after the player's sensitivity and dead zones.
Parameters
padIndex
number
The pad index: 0 for the local player.
control
string | number
The control id, its name or its hash.
Returns
Promise<number>
A Promise of the value from -1.0 to 1.0 (0.0 for a button that is up).
Example
const steer = await mp.game.pad.getControlNormal(0, 30);
getControlUnboundNormal()
getControlUnboundNormal(padIndex,control):Promise<number>
The normalised value of a control without the player's sensitivity settings.
Parameters
padIndex
number
The pad index: 0 for the local player.
control
string | number
The control id, its name or its hash.
Returns
Promise<number>
A Promise of the value from -1.0 to 1.0.
Example
const raw = await mp.game.pad.getControlUnboundNormal(0, 30);
getControlValue()
getControlValue(padIndex,control):Promise<number>
The raw value of a control.
Parameters
padIndex
number
The pad index: 0 for the local player.
control
string | number
The control id, its name or its hash.
Returns
Promise<number>
A Promise of the control's raw integer value, as the game reports it.
Example
const raw = await mp.game.pad.getControlValue(0, 2);
getDisabledControlNormal()
getDisabledControlNormal(padIndex,control):Promise<number>
Reads the value of a control while it is disabled by the script.
Parameters
padIndex
number
The pad index, 0 for the first pad.
control
number
The control's id.
Returns
Promise<number>
A Promise of the value as a float: 0.0..1.0 for a button, -1.0..1.0 for a stick axis.
Example
const value = await mp.game.pad.getDisabledControlNormal(0, 32);
isControlJustPressed()
isControlJustPressed(padIndex,control):Promise<boolean>
Whether a control was pressed on this frame.
Parameters
padIndex
number
The pad index: 0 for the local player.
control
string | number
The control id, its name or its hash.
Returns
Promise<boolean>
A Promise of true only on the frame the control was pressed.
Example
const entered = await mp.game.pad.isControlJustPressed(0, 23);
isControlJustReleased()
isControlJustReleased(padIndex,control):Promise<boolean>
Whether a control was released on this frame.
Parameters
padIndex
number
The pad index: 0 for the local player.
control
string | number
The control id, its name or its hash.
Returns
Promise<boolean>
A Promise of true only on the frame the control was released.
Example
const justReleased = await mp.game.pad.isControlJustReleased(0, 23);
isControlPressed()
isControlPressed(padIndex,control):Promise<boolean>
Whether a control is held down.
Parameters
padIndex
number
The pad index: 0 for the local player.
control
string | number
The control id, its name or its hash.
Returns
Promise<boolean>
A Promise of true while the control is held.
Example
const held = await mp.game.pad.isControlPressed(0, 24);
isControlReleased()
isControlReleased(padIndex,control):Promise<boolean>
Whether a control is released (not held).
Parameters
padIndex
number
The pad index: 0 for the local player.
control
string | number
The control id, its name or its hash.
Returns
Promise<boolean>
A Promise of true while the control is not held.
Example
const released = await mp.game.pad.isControlReleased(0, 24);
isLookInverted()
isLookInverted():Promise<boolean>
Whether the look controls are inverted in the player's settings.
Returns
Promise<boolean>
A Promise of true when the vertical look is inverted.
Example
const inverted = await mp.game.pad.isLookInverted();
setInputExclusive()
setInputExclusive(padIndex,control):void
Gives a control exclusively to this script: other scripts no longer receive it.
Parameters
padIndex
number
The pad index: 0 for the local player.
control
string | number
The control id, its name or its hash.
Returns
void
Example
mp.game.pad.setInputExclusive(0, 31);