stormyy / q3tool
Quake 3 服务器与 PHP 交互
0.2.1
2017-05-24 19:09 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-19 07:18:46 UTC
README
PHP 类,用于与基于 ioquake3 游戏服务器工作。从 c9jester/q3tool 分支,并包含了 avail/q3tool 的修复
概述
Q3Tool 是一个简单的 PHP 类,允许开发者快速方便地从基于 Quake 3 (ioq3) 引擎的游戏服务器检索信息,或向其发送远程命令 (RCON)。它是为 Urban Terror 服务器开发的,并且已经广泛使用,但应该适用于所有使用 ioq3(甚至只使用相同的协议)的游戏。
使用方法
// Using composer (https://packagist.org.cn/packages/jester/q3tool) require('vendor/autoload.php'); // Or stand-alone require('q3tool.php'); // Default port, no RCON $tool = new q3tool("myclan.org"); // Non-default port, no RCON $tool = new q3tool("myclan.org", 27961); // Including RCON $tool = new q3tool("myclan.org", 27960, "super1337password"); // Get a list of players as an array $players = $tool->get_info("playerlist"); // Or just how many players are on $player_num = $tool->get_info("players"); // Sending an RCON command $response = $tool->send_rcon('bigtext "Hello all!"');
有关获取所需信息的更多信息,请参阅 DATA_TYPES。
已知问题
通过发送 RCON 命令获取控制台响应最不可靠。这似乎是 ioq3 在通过网络发送时截断回复的问题。我尚未找到解决方案。然而,发送命令是可行的。