serverCommand: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " \| *(game[0-9]|version[0-9]|gr[0-9]|serverExec|mp|pr|descr|s[0-9]|p[0-9]{1,3}|r[0-9]|x1?[0-9]|seealso) *= +" to " |$1= ") |
Lou Montana (talk | contribs) (Add categories) |
||
Line 16: | Line 16: | ||
|descr= Executes the given [[Multiplayer_Server_Commands|server command]]. | |descr= Executes the given [[Multiplayer_Server_Commands|server command]]. | ||
* Available commands for execution can be found with [[serverCommandAvailable]] | {{Feature|informative| | ||
* Commands that can be executed can be found with [[serverCommandExecutable]] | * Available commands for execution can be found with [[serverCommandAvailable]] | ||
* Commands that can be executed can be found with [[serverCommandExecutable]] | |||
}} | |||
{{Feature | important | If [[serverCommand]] is executed on a client, it must be executed from [[isUIContext|UI context]], such as [[User Interface Event Handlers#onButtonDown|"onButtonDown"]] or similar events (see [[User Interface Event Handlers]]).}} | |||
|s1= [[serverCommand]] command | |s1= [[serverCommand]] command | ||
Line 27: | Line 29: | ||
|r1= [[Boolean]] - always [[true]] for some reason (since {{arma3}} v1.39 also [[false]] if a non valid command is used ("#blah")) | |r1= [[Boolean]] - always [[true]] for some reason (since {{arma3}} v1.39 also [[false]] if a non valid command is used ("#blah")) | ||
|s2= password [[serverCommand]] command | |s2= password [[serverCommand]] command {{Icon|serverExec|32}} | ||
|s2since= arma3 1.40 | |||
|p21= password : [[String]] - password defined in [[server.cfg]] with <tt>serverCommandPassword</tt> param | |p21= password : [[String]] - password defined in [[server.cfg]] with <tt>serverCommandPassword</tt> param | ||
Line 40: | Line 44: | ||
<code>[[with]] [[uiNamespace]] [[do]] | <code>[[with]] [[uiNamespace]] [[do]] | ||
{ | { | ||
[[private]] _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"; | [[serverCommand]] "#userlist"; | ||
Line 52: | Line 56: | ||
|x3= <code>[[serverCommand]] [[format]] ["#kick %1",_name];</code> | |x3= <code>[[serverCommand]] [[format]] ["#kick %1",_name];</code> | ||
|x4= <code>_passwordWasOK = "MyServerCommandPassword" [[serverCommand]] "#lock";</code> | |x4= <code>[[private]] _passwordWasOK = "MyServerCommandPassword" [[serverCommand]] "#lock";</code> | ||
|seealso= [[serverCommandAvailable]], [[serverCommandExecutable]], [[admin]], [[isUIContext]] | |seealso= [[serverCommandAvailable]], [[serverCommandExecutable]], [[admin]], [[isUIContext]] | ||
}} | }} | ||
[[Category:Scripting Commands: Server Execution]] | |||
[[Category:Introduced with Arma 3 version 1.40]] |
Revision as of 22:44, 5 November 2021
Description
- Description:
- Executes the given server command.
- Groups:
- Multiplayer
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 SEServer
- 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 { private _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:
private _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
Categories:
- Scripting Commands
- Introduced with Arma 2 version 1.05
- Arma 2: New Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Multiplayer
- Scripting Commands: Server Execution
- Introduced with Arma 3 version 1.40