# toggleControl (Client)

> 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.

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

## Syntax

```lua
bool toggleControl(string control, bool enabled)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `control` | `string` | The control's name, case insensitive. |
| `enabled` | `bool` | `true` to turn it on, `false` to turn it off. |

## Returns

`true` if it changed. `false` if the control name does not exist.

Turning off `fire` (or `vehicle_fire` inside a vehicle) stops the player from shooting. On a movement control, the direction that is off is zeroed.

## Example

```lua
toggleControl("fire", false)
toggleControl("aim_weapon", false)
setTimer(function()
    toggleControl("fire", true)
    toggleControl("aim_weapon", true)
end, 10000, 1)
```

### Coming from MTA

Besides MTA's controls, MYMP has `block` (melee block) and `reload`.

## See also

- [isControlEnabled (Client)](https://wiki.mymp.gg/en/isControlEnabled-client.md): Tells whether one of the local player's controls is on.
- [toggleAllControls (Client)](https://wiki.mymp.gg/en/toggleAllControls-client.md): Turns all of the local player's controls on or off at once.
- [setControlState (Client)](https://wiki.mymp.gg/en/setControlState-client.md): Presses or releases one of a ped's controls as if it were a key, for example to make it walk, jump or shoot.
- [toggleControl (Server)](https://wiki.mymp.gg/en/toggleControl-server.md): Turns one of a player's controls on or off. Their client stops passing that control to the game, even with its key held down.
