跳到主要内容

SendRconCommand

描述

发送 RCON(远程控制台)命令

参数名说明
const format[]需要执行的 RCON 命令
OPEN_MP_TAGS:...不定数量的任意标签类型参数

返回值

该函数始终返回 1

示例代码

SendRconCommand("gmx");
// 等效于在游戏内输入"/rcon gmx"
// GMX命令将重启游戏模式

// 使用format()的示例
new szMapName[] = "Los Santos";
new szCmd[64];
format(szCmd, sizeof(szCmd), "mapname %s", szMapName);
SendRconCommand(szCmd);

// 专业提示:open.mp中无需使用format
SendRconCommand("game.map %s", szMapName);

注意事项

注意
  • 因缺少 playerid 参数,不支持登录操作
  • 'password 0'命令将清除服务器已设置的密码
  • 该命令会触发OnRconCommand回调
信息

参见config.json配置文件

相关函数

相关回调