# toggleAllControls (Client)

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

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Controls
- **URL**: https://wiki.mymp.gg/en/toggleAllControls-client
- **Counterpart**: Also exists on the server, with its own implementation: [toggleAllControls (Server)](https://wiki.mymp.gg/en/toggleAllControls-server.md)

## Syntax

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

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `enabled` | `bool` | `true` to turn them on, `false` to turn them off. |
| `gtaControls` | `bool` | Whether it applies to the game's controls, such as walking, shooting and driving. *(default: `true`)* |
| `mtaControls` | `bool` | Whether 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

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

## See also

- [toggleControl (Client)](https://wiki.mymp.gg/en/toggleControl-client.md): Turns one of the local player's controls on or off. A control that is off does not reach the game, even with its key held down.
- [isControlEnabled (Client)](https://wiki.mymp.gg/en/isControlEnabled-client.md): Tells whether one of the local player's controls is on.
- [bindKey (Shared)](https://wiki.mymp.gg/en/bindKey.md): Binds a key to a function or a command. The function runs when the key is pressed, released or both.
- [toggleAllControls (Server)](https://wiki.mymp.gg/en/toggleAllControls-server.md): Turns all of a player's controls on or off at once. The order goes to their client.
