serverCommand: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "Category:Scripting Commands ArmA2" to "Category:Scripting Commands Arma 2") |
Lou Montana (talk | contribs) (Fix Category:Pages using duplicate arguments in template calls and description) |
||
Line 5: | Line 5: | ||
|1.05|Game version= | |1.05|Game version= | ||
____________________________________________________________________________________________ | |||
| Executes the given [[Multiplayer_Server_Commands|server command]]. | |||
* Available commands for execution can be found with [[serverCommandAvailable]]. | |||
* Commands that can be executed can be found with [[serverCommandExecutable]]. | |||
| | {{Informative | 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]]).}} | ||
As of | {{Feature arma3 | As of {{arma3}} 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= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | [[serverCommand]] command |SYNTAX= | ||
|p1= command : [[String]] |PARAMETER1= | |p1= command : [[String]] |PARAMETER1= | ||
| [[Boolean]] - always [[true]] for some reason (since | | [[Boolean]] - always [[true]] for some reason (since {{arma3}} v1.39 also [[false]] if a non valid command is used ("#blah")) |RETURNVALUE= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| s2= password | |s2= password [[serverCommand]] command {{since|arma3|1.39|y}} {{ServerExec}}|SYNTAX2= | ||
|p21= password : [[String]] - password defined in [[server.cfg]] with <tt>serverCommandPassword</tt> param |PARAMETER21= | |p21= password : [[String]] - password defined in [[server.cfg]] with <tt>serverCommandPassword</tt> param |PARAMETER21= | ||
|p22= command : [[String]] - server command |PARAMETER2= | |p22= command : [[String]] - server command |PARAMETER2= | ||
| r2= [[Boolean]] - [[true]] if password is correct | | |r2= [[Boolean]] - [[true]] if password is correct |RETURNVALUE2= | ||
__________________________________________________________________ | __________________________________________________________________ | ||
|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: | ||
<code>[[with]] [[uiNamespace]] [[do]] | <code>[[with]] [[uiNamespace]] [[do]] | ||
{ | { | ||
Line 46: | Line 48: | ||
| [[serverCommandAvailable]], [[serverCommandExecutable]], [[admin]], [[isUIContext]] |SEEALSO= | | [[serverCommandAvailable]], [[serverCommandExecutable]], [[admin]], [[isUIContext]] |SEEALSO= | ||
}} | }} | ||
Revision as of 22:43, 14 January 2020
Description
- Description:
- Executes the given server command.
- Available commands for execution can be found with serverCommandAvailable.
- Commands that can be executed can be found with serverCommandExecutable.
- Groups:
- Uncategorised
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 Template:since 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