# setControlState (Server)

> Presses or releases one of a player's controls as if it were a key. The order goes to their client, which applies it as `setControlState` on the local player.

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

## Syntax

```lua
bool setControlState(player thePlayer, string control, bool state)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `thePlayer` | `player` | The player. |
| `control` | `string` | The control's name, case insensitive. |
| `state` | `bool` | `true` to hold it down, `false` to release it. |

## Returns

`true` if the order was sent. `false` if the element is not a player or the control name does not exist.

## Example

```lua
addCommandHandler("handbrake", function(player)
    if isPedInVehicle(player) then
        setControlState(player, "handbrake", true)
    end
end)
```

### Coming from MTA

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

### Note

The player's own input on that control replaces the state the server sent.

## See also

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