M MY Multiplayer: Wiki
Side
Kind

toggleAllControls

Client

Turns all of the local player's controls on or off at once.

Also exists on the server, with its own implementation: toggleAllControls

bool toggleAllControls(bool enabled [, bool gtaControls = true, bool mtaControls = true])

Parameters

NameTypeDescription
enabledbooltrue to turn them on, false to turn them off.
gtaControlsboolWhether it applies to the game's controls, such as walking, shooting and driving.default true
mtaControlsboolWhether it applies to keys bound to commands with bindKey. While off, those keys do not run their command; keys bound to functions keep working.default true

Returns

Always true.

Example

addEventHandler("onClientResourceStart", resourceRoot, function()
    toggleAllControls(false, true, false)
    setTimer(toggleAllControls, 5000, 1, true)
end)

See also