serverCommand: Difference between revisions
Jump to navigation
Jump to search
m (Fix wording) |
Killzone Kid (talk | contribs) (tidying up) |
||
Line 8: | Line 8: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Executes [[Multiplayer_Server_Commands|a server command]]. Which command is available for execution can be found with [[serverCommandAvailable]] and whether or not it can be executed with [[serverCommandExecutable]]. | | Executes the given [[Multiplayer_Server_Commands|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 [[isUIContext | UI context]], such as ''onButtonDown'' or similar events (see [[User_Interface_Event_Handlers]]). | ||
If [[serverCommand]] is executed on a client, it must be executed from | |||
<br><br> | <br><br> | ||
As of Arma 3 v1.39 [[serverCommand]] can be used on dedicated server and headless clients. | As of Arma 3 v1.39 an alternative version of [[serverCommand]] can be used on dedicated server and headless clients. It requires a password, set with <tt>serverCommandPassword</tt> in [[server.cfg]] and passed to the command as an argument (See Alt Syntax)|= Description | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 25: | Line 23: | ||
| s2= password '''serverCommand''' command ''(since Arma 3 v1.39)'' {{ServerExec}}|= Syntax | | s2= password '''serverCommand''' command ''(since Arma 3 v1.39)'' {{ServerExec}}|= Syntax | ||
|p21= password : [[String]] - password defined in [[server.cfg]] with | |p21= password : [[String]] - password defined in [[server.cfg]] with <tt>serverCommandPassword</tt> param |= Parameter 1 | ||
|p22= command : [[String]] - server command |= Parameter 2 | |p22= command : [[String]] - server command |= Parameter 2 | ||
Line 45: | Line 43: | ||
};</code> | };</code> | ||
|x3 = <code>[[serverCommand]] [[format]] ["#kick %1",_name];</code> | |x3 = <code>[[serverCommand]] [[format]] ["#kick %1",_name];</code> | ||
|x4 = <code> | |x4 = <code>_passwordWasOK = "MyServerCommandPassword" [[serverCommand]] "#lock";</code> | ||
| [[serverCommandAvailable]], [[serverCommandExecutable]], [[admin]] |= See also | | [[serverCommandAvailable]], [[serverCommandExecutable]], [[admin]] |= See also |
Revision as of 14:03, 2 February 2019
Description
- Description:
- Executes the given 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 context, such as onButtonDown or similar events (see User_Interface_Event_Handlers).
As of Arma 3 v1.39 an alternative version of serverCommand can be used on dedicated server and headless clients. It requires a password, set with serverCommandPassword in server.cfg and passed to the command as an argument (See Alt Syntax) - 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:
_passwordWasOK = "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