serverCommand: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " <dl class="command_description"> </dl>" to "") |
(formatting) |
||
Line 1: | Line 1: | ||
{{RV|type=command | {{RV|type=command | ||
| arma2 | |game1= arma2 | ||
|1.05 | |version1= 1.05 | ||
|game2= arma2oa | |||
|version2= 1.51 | |||
|game3= tkoh | |||
|version3= 1.00 | |||
|game4= arma3 | |||
|version4= 0.50 | |||
|gr1= Multiplayer | |gr1= Multiplayer | ||
| 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]]. | * Available commands for execution can be found with [[serverCommandAvailable]]. | ||
* Commands that can be executed can be found with [[serverCommandExecutable]]. | * Commands that can be executed can be found with [[serverCommandExecutable]]. | ||
{{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]]).}} | |pr= {{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]]).}} | ||
|s1 [[serverCommand]] command | |||
| [[serverCommand]] command | |||
|p1= command : [[String]] | |p1= command : [[String]] | ||
| [[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 {{GVI|arma3|1.40|y}} {{Icon|serverExec|32}} | ||
|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 | ||
|p22= command : [[String]] - server command | |p22= command : [[String]] - server command | ||
Line 29: | Line 40: | ||
|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 41: | Line 53: | ||
}]; | }]; | ||
};</code> | };</code> | ||
|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>_passwordWasOK = "MyServerCommandPassword" [[serverCommand]] "#lock";</code> | ||
|seealso= [[serverCommandAvailable]], [[serverCommandExecutable]], [[admin]], [[isUIContext]] | |seealso= [[serverCommandAvailable]], [[serverCommandExecutable]], [[admin]], [[isUIContext]] | ||
}} | }} | ||
Revision as of 10:38, 12 March 2021
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.
- Problems:
- Groups:
- Multiplayer
Syntax
- Syntax:
- Syntax needed
- Parameters:
- command : String
- Return Value:
- Return value needed
Alternative Syntax
- Syntax:
- password serverCommand command 1.40 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
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