serverCommand: Difference between revisions
Jump to navigation
Jump to search
Austin medic (talk | contribs) m (Clarification that ui event handler is not needed in A3 to use severCommand) |
m (Fix wording) |
||
Line 13: | Line 13: | ||
<br><br> | <br><br> | ||
As of Arma 3 v1.39 [[serverCommand]] can be used on dedicated server and headless clients. This requires a password, both set in [[server.cfg]] and passed to the command itself (See Alt Syntax). | As of Arma 3 v1.39 [[serverCommand]] can be used on dedicated server and headless clients. This requires a password, both set in [[server.cfg]] and passed to the command itself (See Alt Syntax). This new version also doesn't need to be executed from within a UI Eventhandler.|= Description | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Revision as of 00:23, 5 November 2017
Description
- Description:
- Executes a server command. Which command is available for execution can be found with serverCommandAvailable and whether or not it can be executed with serverCommandExecutable.
If serverCommand is executed on a client, it must be executed from UI event handler (ctrlAddEventHandler, displayAddEventHandler), such as onButtonDown or other User_Interface_Event_Handlers.
As of Arma 3 v1.39 serverCommand can be used on dedicated server and headless clients. This requires a password, both set in server.cfg and passed to the command itself (See Alt Syntax). This new version also doesn't need to be executed from within a UI Eventhandler. - Groups:
- Uncategorised
Syntax
- Syntax:
- serverCommand command
- Parameters:
- command : String
- Return Value:
- Boolean - always true for some reason (since A3 v1.39 also false if a non valid command is used ("#blah"))
Alternative Syntax
- Syntax:
- password serverCommand command (since Arma 3 v1.39) Template:ServerExec
- 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:
_isOK = "MyServerCommandPassword" serverCommand "#lock";
Additional Information
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