武装突袭 Wiki
Advertisement
  This scripting command must be executed on the server to work properly in multiplayer

点击图片可看到更多讯息

开始使用于

游戏:
Arma 2
版本:
1.05

描述

描述:
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 and whether or not it can be executed with serverCommandExecutable.

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

As of Arma 3 v1.39 serverCommand can be used on dedicated server and headless clients. This requires a password, both set in server.cfg and passed to the command itself.

基本句法

句法:
serverCommand command
参数:
command : String
返回值:
Boolean - always true for some reason (since A3 v1.39 also false if a non valid command is used ("#blah"))

替代句法

句法:
password serverCommand command      (since Arma 3 v1.39)
参数:
password : String - password defined in server.cfg with serverCommandPassword param
command : String
返回值:
Boolean - true if password is correct

范例

范例1:
serverCommand "#logout";
范例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"} ]; };
范例3:
serverCommand format ["#kick %1",_name];

额外资讯

多人游戏:
-
也可以看看:
serverCommandAvailableserverCommandExecutable

注意事项

此处撰写句法皆为可行用法. 可到官网[1]专页回报错误. 你可以使用讨论页面或是论坛来进行讨论.
新增注意事项 | 如何新增?

Notes

Bottom Section

Advertisement