|
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#define SERVER_1_STEAM "steam://connect/your.steam.server.ip:port"
#define SERVER_2_STEAM "steam://connect/another.steam.server.ip:port"
#define SERVER_1_IP "your.server.ip:port"
#define SERVER_2_IP "another.server.ip:port"
// 玩家触发转服的命令
public plugin_init()
{
register_clcmd("+use", "cmd_use");
}
public cmd_use(id)
{
if (!is_user_connected(id))
return;
// 获取玩家是否为正版
if (is_user_steam(id))
{
client_print(id, print_chat, "你是正版玩家,准备转服到另一个服务器...");
}
else
{
client_print(id, print_chat, "你是盗版玩家,准备转服到另一个服务器...");
}
// 延迟1秒后转服
set_task(1.0, "transfer_server", id);
}
public transfer_server(id)
{
if (!is_user_connected(id))
return;
// 获取玩家是否为正版
if (is_user_steam(id))
{
// 正版玩家,使用steam协议连接
new server = random_num(1, 2);
if (server == 1)
{
client_print(id, print_chat, "你将转服到正版服务器 1...");
client_cmd(id, "connect %s", SERVER_1_STEAM);
}
else
{
client_print(id, print_chat, "你将转服到正版服务器 2...");
client_cmd(id, "connect %s", SERVER_2_STEAM);
}
}
else
{
// 盗版玩家,直接使用IP连接
new server = random_num(1, 2);
if (server == 1)
{
client_print(id, print_chat, "你将转服到盗版服务器 1...");
client_cmd(id, "connect %s", SERVER_1_IP);
}
else
{
client_print(id, print_chat, "你将转服到盗版服务器 2...");
client_cmd(id, "connect %s", SERVER_2_IP);
}
}
}
// 在插件卸载时清理任务
public plugin_end()
{
remove_task();
}
|
|