serverCommand: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " *\| *PARAMETER[0-9]{1,3} *= * " to " ")
m (Text replacement - "\{\{( *)Informative( *)\|" to "{{$1Feature$2|$2Informative$2|")
Line 11: Line 11:
* Commands that can be executed can be found with [[serverCommandExecutable]].
* 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]]).}}
{{Feature | 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]]).}}


{{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).}}
{{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).}}

Revision as of 01:12, 7 February 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
Multiplayer

Syntax

Syntax:
Syntax needed
Parameters:
command : String
Return Value:
Return value needed

Alternative Syntax

Syntax:
password serverCommand command Template:Since 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 { 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

See also:
See also needed

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