Skip to content
M2O Scripting APIScripting reference
Global objectClient APIGenerated

Controls

const Controls: object

Defined in: client/api.d.ts:711

Controls whether local gameplay input is accepted, and which individual abilities it drives.

readonly Style: Readonly<Record<"Walk" | "Run" | "Sprint" | "Use" | "CloseCombat" | "Fire" | "CarInOut" | "CarDrive" | "CarAccessories" | "Covers" | "Obstacles" | "WeaponManip" | "WeaponSelect" | "Zoom" | "Crouch" | "ForceCrosshairOn" | "ForceCrosshairOff" | "WeaponPickup" | "CarShootDisabled" | "All" | "None" | "NoWeapons", number>>

Per-ability input mask bits for Controls.setStyle. A set bit allows that ability; All is the default and None blocks everything. NoWeapons blocks firing, reloading, and drawing while leaving melee and movement intact.

disable(): void

Disables local gameplay controls until they are enabled again.

void

enable(): void

Enables local gameplay controls, also releasing a hold left by a finished scripted animation.

void

getStyle(): number

Returns the ability mask currently applied to local input.

number

Bitmask of Controls.Style values.

isEnabled(): boolean

Checks whether local gameplay controls are currently enabled.

boolean

True when gameplay input is accepted.

setEnabled(enabled): void

Sets whether local gameplay controls are enabled.

boolean

True to accept gameplay input; false to lock it.

void

setStyle(flags): void

Sets which abilities the local client accepts input for. Pass Controls.Style.NoWeapons for a weapons-free area or Controls.Style.All to restore the default; the mask survives respawn.

number

Bitmask of Controls.Style values; a set bit allows that ability.

void