---
name: "serverCommand"
type: command
status: ok
groups: ["Multiplayer"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/serverCommand
revid: 377886
updated: 2026-01-04T16:30:46Z
---

# serverCommand

*Command · Multiplayer · Arma 3 v0.50 · introduced in Arma 2 v1.05*

## Description

Executes the given server command. Requires you to be **logged-in** [admin](../commands/admin.md) as client to execute on a client, or provide the **serverCommandPassword** with the serverCommand execution as client/server to basically also get logged in [admin](../commands/admin.md) permissions.

> [!NOTE]
> - Available commands for execution can be found with [serverCommandAvailable](../commands/serverCommandAvailable.md)
> - Commands that can be executed can be found with [serverCommandExecutable](../commands/serverCommandExecutable.md)

> [!IMPORTANT]
> If [serverCommand](../commands/serverCommand.md) is executed on a client, it must be executed from [UI context](../commands/isUIContext.md), such as ["onButtonDown"](../topics/User_Interface_Event_Handlers.md#onbuttondown) or similar events (see [User Interface Event Handlers](../topics/User_Interface_Event_Handlers.md)).

## Syntax

### Syntax 1

```sqf
serverCommand command
```

**Parameters:**

- `command`: [String](../topics/String.md)

**Returns:** [Boolean](../topics/Boolean.md) - [false](../commands/false.md) if a non valid command is used ("#blah"), false otherwise (was always [true](../commands/true.md) before Arma 3 v1.40)

### Syntax 2

*since arma3 1.40 · execution: server*

```sqf
password serverCommand command
```

**Parameters:**

- `password`: [String](../topics/String.md) - case-sensitive password defined in server config with `serverCommandPassword` param
- `command`: [String](../topics/String.md) - server command

**Returns:** [Boolean](../topics/Boolean.md) - [false](../commands/false.md) if command failed at some stage. [true](../commands/true.md) doesn't mean that command succeeded.

## Examples

### Example 1

```sqf
serverCommand "#logout";
```

### Example 2

Create button on the main map which will show userlist to anyone who clicks on it:

```sqf
with uiNamespace do 
{
    private _ctrl = findDisplay 12 ctrlCreate ["RscButton", -1];
    _ctrl ctrlSetPosition [0,0,0.5,0.1];
    _ctrl ctrlSetText "USERLIST";
    _ctrl ctrlCommit 0;
    _ctrl ctrlAddEventHandler ["ButtonDown", 
    {
        serverCommand "#userlist";
    }];
};
```

### Example 3

```sqf
serverCommand format ["#kick %1",_name];
```

### Example 4

```sqf
private _passwordWasOK = "MyServerCommandPassword" serverCommand "#lock";
```

## See also

[serverCommandAvailable](../commands/serverCommandAvailable.md) · [serverCommandExecutable](../commands/serverCommandExecutable.md) · [admin](../commands/admin.md) · [isUIContext](../commands/isUIContext.md)

<sub>Source: [BI Community Wiki — serverCommand](https://community.bistudio.com/wiki/serverCommand) (revision 377886).</sub>
