serverCommand: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (see also) |
Killzone Kid (talk | contribs) (alt syntax) |
||
Line 7: | Line 7: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Executes [[Multiplayer_Server_Commands|a server command]] on the server. In order to be able to execute admin command the user must be logged in as admin. Commands available for non-admin users are: #login, #vote and #userlist. Which command is available can be detected with [[serverCommandAvailable]] and whether or not it can be executed with [[serverCommandExecutable]].<br><br>'''NOTE:''' This command must be executed from UI event handler ([[ctrlAddEventHandler]], [[displayAddEventHandler]]), such as ''onButtonDown'' or other [[User_Interface_Event_Handlers]]. |= Description | | Executes [[Multiplayer_Server_Commands|a server command]] on the server. In order to be able to execute admin command the user must be logged in as admin. Commands available for non-admin users are: #login, #vote and #userlist. Which command is available can be detected with [[serverCommandAvailable]] and whether or not it can be executed with [[serverCommandExecutable]].<br><br>'''NOTE:''' This command must be executed from UI event handler ([[ctrlAddEventHandler]], [[displayAddEventHandler]]), such as ''onButtonDown'' or other [[User_Interface_Event_Handlers]]. | ||
<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. |= Description | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 16: | Line 17: | ||
| [[Boolean]] - always [[true]] for some reason |= Return value | | [[Boolean]] - always [[true]] for some reason |= Return value | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| s2= password '''serverCommand''' command ''(since Arma 3 v1.39)''|= Syntax | |||
|p21= password : [[String]] - password defined in [[server.cfg]] with ''serverCommandPassword'' param |= Parameter 1 | |||
|p22= command : [[String]] |= Parameter 2 | |||
| r2= [[Boolean]] - [[true]] if password is correct |= Return value | |||
__________________________________________________________________ | |||
|x1 = <code>[[serverCommand]] "#logout";</code> | |x1 = <code>[[serverCommand]] "#logout";</code> | ||
|x2 = Create button on the main map which will show userlist to anyone who clicks on it: | |x2 = Create button on the main map which will show userlist to anyone who clicks on it: |
Revision as of 10:23, 22 February 2015
Description
- Description:
- Executes a server command on the server. In order to be able to execute admin command the user must be logged in as admin. Commands available for non-admin users are: #login, #vote and #userlist. Which command is available can be detected with serverCommandAvailable and whether or not it can be executed with serverCommandExecutable.
NOTE: This command 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. - Groups:
- Uncategorised
Syntax
- Syntax:
- serverCommand command
- Parameters:
- command : String
- Return Value:
- Boolean - always true for some reason
Alternative Syntax
- Syntax:
- password serverCommand command (since Arma 3 v1.39)
- Parameters:
- password : String - password defined in server.cfg with serverCommandPassword param
- command : String
- 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];
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