# executeCommandHandler (Client)

> Runs the handlers client scripts registered for a command, as if it had been typed.

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

## Syntax

```lua
bool executeCommandHandler(string commandName, any ...)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `commandName` | `string` | The command's name. |
| `...` | `any` | Arguments passed to the handlers, each turned into a string. |

## Returns

`true` if a running resource handled the command, `false` if none did.

It runs every resource's handlers, not only this one's. The command is not sent to the server.

## Example

```lua
addCommandHandler("zoom", function(command, level)
    outputDebugString("zoom " .. tostring(level))
end)

executeCommandHandler("zoom", 2)
```

## See also

- [addCommandHandler (Shared)](https://wiki.mymp.gg/en/addCommandHandler.md): Registers a function that runs when the command is typed in the console. The arguments arrive as space-separated strings.
- [removeCommandHandler (Shared)](https://wiki.mymp.gg/en/removeCommandHandler.md): Removes the handler this resource registered for a command.
- [executeCommandHandler (Server)](https://wiki.mymp.gg/en/executeCommandHandler-server.md): Runs the handlers server scripts registered for a command, as if the player had typed it.
