# getControlState (Client)

> Tells whether one of a ped's controls is pressed, such as `forwards`, `fire` or `accelerate`.

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

## Syntax

```lua
bool getControlState(string control [, ped thePed = localPlayer])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `thePed` | `ped` | The ped or player. It can be left out, which means the local player. *(default: `localPlayer`)* |
| `control` | `string` | The control's name, case insensitive. |

## Returns

`true` if the control is pressed. `false` if it is not, if the control name does not exist or if the ped cannot be read.

On the local player it reads what the game gets this frame, including what a script turned on with `setControlState`. Vehicle controls only count inside a vehicle and on-foot ones only outside; with the engine off, `accelerate` does not count. On a remote player it reads the controls that came over the network. On a ped it reads what a script set on it.

## Example

```lua
addEventHandler("onClientRender", root, function()
    if getControlState("sprint") then
        dxDrawText("Correndo", 20, 300)
    end
end)
```

### Coming from MTA

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

## See also

- [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.
- [getPedAnalogControlState (Client)](https://wiki.mymp.gg/en/getPedAnalogControlState.md): Tells how far one of a ped's controls is pressed, from 0 to 1. It is meant for analog controls such as walking, steering and accelerating.
- [isControlEnabled (Client)](https://wiki.mymp.gg/en/isControlEnabled-client.md): Tells whether one of the local player's controls is on.
- [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.
