serverCommand: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "<code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^<]*) *<\/code>" to "<code>$1$2$3</code>") |
Lou Montana (talk | contribs) m (Text replacement - "\|x([0-9])= *<code>([^<]*)<\/code>" to "|x$1= <sqf>$2</sqf>") |
||
Line 39: | Line 39: | ||
|r2= [[Boolean]] - [[true]] if password is correct | |r2= [[Boolean]] - [[true]] if password is correct | ||
|x1= < | |x1= <sqf>serverCommand "#logout";</sqf> | ||
|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: | ||
Line 54: | Line 54: | ||
};</code> | };</code> | ||
|x3= < | |x3= <sqf>serverCommand format ["#kick %1",_name];</sqf> | ||
|x4= < | |x4= <sqf>private _passwordWasOK = "MyServerCommandPassword" serverCommand "#lock";</sqf> | ||
|seealso= [[serverCommandAvailable]] [[serverCommandExecutable]] [[admin]] [[isUIContext]] | |seealso= [[serverCommandAvailable]] [[serverCommandExecutable]] [[admin]] [[isUIContext]] |
Revision as of 10:24, 13 May 2022
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:
- Example 4:
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