serverCommand: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (see also) |
Killzone Kid (talk | contribs) No edit summary |
||
Line 5: | Line 5: | ||
|1.05|= Game version | |1.05|= Game version | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Executes [[Multiplayer_Server_Commands|a server command]] | | Executes [[Multiplayer_Server_Commands|a server command]]. Which command is available can be detected with [[serverCommandAvailable]] and whether or not it can be executed with [[serverCommandExecutable]]. | ||
<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 | <br><br> | ||
If the command is executed on client, it 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. See Alt Syntax for more information.|= Description | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 19: | Line 22: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| s2= password '''serverCommand''' command ''(since Arma 3 v1.39)''|= Syntax | | s2= password '''serverCommand''' command ''(since Arma 3 v1.39)'' {{ServerExec}}|= Syntax | ||
|p21= password : [[String]] - password defined in [[server.cfg]] with ''serverCommandPassword'' param |= Parameter 1 | |p21= password : [[String]] - password defined in [[server.cfg]] with ''serverCommandPassword'' param |= Parameter 1 | ||
Line 40: | Line 43: | ||
};</code> | };</code> | ||
|x3 = <code>[[serverCommand]] [[format]] ["#kick %1",_name];</code> | |x3 = <code>[[serverCommand]] [[format]] ["#kick %1",_name];</code> | ||
|x4 = <code>_isOK = "MyServerCommandPassword" [[serverCommand]] "#lock";</code> | |||
| [[serverCommandAvailable]], [[serverCommandExecutable]], [[admin]] |= See also | | [[serverCommandAvailable]], [[serverCommandExecutable]], [[admin]] |= See also | ||
Line 55: | Line 59: | ||
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] | ||
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]] | [[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]] | ||
Revision as of 01:04, 19 April 2017
Description
- Description:
- Executes a server command. Which command is available can be detected with serverCommandAvailable and whether or not it can be executed with serverCommandExecutable.
If the command is executed on 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 for more information. - 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
- 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