# isControlEnabled (Server)

> Tells whether one of a player's controls is on, going by what the server sent to their client.

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

## Syntax

```lua
bool isControlEnabled(player thePlayer, string control)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `thePlayer` | `player` | The player. |
| `control` | `string` | The control's name, case insensitive. |

## Returns

`true` if the control is on. `false` if the server turned it off, the element is not a player or the control name does not exist.

## Example

```lua
addCommandHandler("canshoot", function(player)
    if not isControlEnabled(player, "fire") then
        outputServerLog(getPlayerName(player) .. " is not allowed to shoot")
    end
end)
```

### Note

It only reflects what the server sent with `toggleControl` and `toggleAllControls`. A control turned off by a client script is still `true` here.

## See also

- [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.
- [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.
- [getControlState (Server)](https://wiki.mymp.gg/en/getControlState-server.md): Tells whether a player is pressing a control, going by the keys their client last sent.
- [isControlEnabled (Client)](https://wiki.mymp.gg/en/isControlEnabled-client.md): Tells whether one of the local player's controls is on.
