serverCommand: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\|r1 +\[" to "|r1= [")
m (Text replacement - " \| *(game[0-9]|version[0-9]|gr[0-9]|serverExec|mp|pr|descr|s[0-9]|p[0-9]{1,3}|r[0-9]|x1?[0-9]|seealso) *= +" to " |$1= ")
Line 11: Line 11:


|game4= arma3
|game4= arma3
|version4= 0.50
|version4= 0.50


|gr1= Multiplayer
|gr1= Multiplayer

Revision as of 22:27, 19 June 2021

Hover & click on the images for description

Description

Description:
Executes the given server command.
Problems:
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 - always true for some reason (since Arma 3 v1.39 also false if a non valid command is used ("#blah"))

Alternative Syntax

Syntax:
password serverCommand command Arma 3 logo black.png1.40 SEServer
Parameters:
password : String - password defined in server.cfg with serverCommandPassword param
command : String - server command
Return Value:
Boolean - true if password is correct

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 { 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:
_passwordWasOK = "MyServerCommandPassword" serverCommand "#lock";

Additional Information

See also:
serverCommandAvailableserverCommandExecutableadminisUIContext

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