serverCommand: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(returns boolean)
(description example)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Executes [[Multiplayer_Server_Commands|an admin command]] on the server. If used in singleplayer or in multiplayer, but without required privileges (player using the computer where command is executed is not an admin) nothing happens. This can be detected beforehand using [[serverCommandAvailable]]. |= Description
| Executes [[Multiplayer_Server_Commands|a server command]] on the server. In order to be able to execute admin command the user must be logged in as admin. Commands available for non-admin users are: #login, #vote and #userlist. Which command is available can be detected with [[serverCommandAvailable]].<br><br>'''NOTE:''' This command must be executed from UI event handler ([[ctrlAddEventHandler]], [[displayAddEventHandler]]), such as ''onButtonDown'' or other [[User_Interface_Event_Handlers]]. |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 16: Line 16:
| [[Boolean]] - always [[true]] for some reason |= Return value
| [[Boolean]] - always [[true]] for some reason |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________
|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:
<code>[[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"}
];
};</code>
|x3 = <code>[[serverCommand]] [[format]] ["#kick %1",_name];</code>
 
| [[serverCommandAvailable]] |= See also
| [[serverCommandAvailable]] |= See also


Line 23: Line 36:
<h3 style="display:none">Notes</h3>
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
serverCommand format["#kick %1",_name];
<dd class="notedate">Posted on 9 June 2011
<dt class="note>'''[[User:Piotr|Piotr]]'''
<dd class="note">
serverCommand (probably) has been disabled in 1.59
<!-- Note Section END -->
</dl>
</dl>



Revision as of 20:03, 14 October 2014

Hover & click on the images for description

Description

Description:
Executes a server command on the server. In order to be able to execute admin command the user must be logged in as admin. Commands available for non-admin users are: #login, #vote and #userlist. Which command is available can be detected with serverCommandAvailable.

NOTE: This command must be executed from UI event handler (ctrlAddEventHandler, displayAddEventHandler), such as onButtonDown or other User_Interface_Event_Handlers.
Groups:
Uncategorised

Syntax

Syntax:
serverCommand command
Parameters:
command : String
Return Value:
Boolean - always true for some reason

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];

Additional Information

See also:
serverCommandAvailable

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

Notes

Bottom Section