serverCommand

From Bohemia Interactive Community
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Hover & click on the images for description

Description

Description:
Executes the given server command.
If serverCommand is executed on a client, it must be executed from UI context, such as "onButtonDown" or similar events (see User Interface Event Handlers).
Groups:
Multiplayer

Syntax

Syntax:
serverCommand command
Parameters:
command : String
Return Value:
Boolean - false if a non valid command is used ("#blah"), false otherwise (was always true before Arma 3 logo black.png1.40)

Alternative Syntax

Syntax:
password serverCommand command
Parameters:
password : String - case-sensitive password defined in server.cfg with serverCommandPassword param
command : String - server command
Return Value:
Boolean - false if command failed at some stage. true doesn't mean that command succeeded.

Examples

Example 1:
serverCommand "#logout";
Example 2:
Create button on the main map which will show userlist to anyone who clicks on it:
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:
serverCommand format ["#kick %1",_name];
Example 4:
private _passwordWasOK = "MyServerCommandPassword" serverCommand "#lock";

Additional Information

See also:
serverCommandAvailable serverCommandExecutable admin isUIContext

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note