#include <amxmodx>
new pcvar_servers, pcvar_server1, pcvar_ip1, pcvar_server2, pcvar_ip2, pcvar_server3, pcvar_ip3, pcvar_server4, pcvar_ip4, pcvar_server5, pcvar_ip5, pcvar_server6, pcvar_ip6;
new szServerName1[46], szServerIp1[23], szServerName2[46], szServerIp2[23], szServerName3[46], szServerIp3[23], szServerName4[46], szServerIp4[23], szServerName5[46], szServerIp5[23], szServerName6[38], szServerIp6[23];
new szText[1200];
public plugin_precache()
server_cmd(“exec addons/amxmodx/configs/auto_gm.cfg”);
public plugin_init()
{
register_plugin(“GameMenu Changer 6 servers”, “by kp3t3h” , “kpeteh@live.com”);
new size = sizeof(szText) – 1;
pcvar_servers = register_cvar(“agm_servers”, “6”);
pcvar_ip1 = register_cvar(“agm_serverip1”, “1.1.1.1:27015”);
pcvar_server1 = register_cvar(“agm_server1”, “内容”);
pcvar_ip2 = register_cvar(“agm_serverip2”, “1.1.1.1:27015”);
pcvar_server2 = register_cvar(“agm_server2”, “内容”);
pcvar_ip3 = register_cvar(“agm_serverip3”, “1.1.1.1:27015”);
pcvar_server3 = register_cvar(“agm_server3”, “内容”);
pcvar_ip4 = register_cvar(“agm_serverip4”, “1.1.1.1:27015”);
pcvar_server4 = register_cvar(“agm_server4”, “内容”);
pcvar_ip5 = register_cvar(“agm_serverip5”, “1.1.1.1:27015”);
pcvar_server5 = register_cvar(“agm_server5”, “内容”);
pcvar_ip6 = register_cvar(“agm_serverip6”, “1.1.1.1:27015”);
pcvar_server6 = register_cvar(“agm_server6”, “内容”);
get_pcvar_string(pcvar_ip1, szServerIp1, charsmax(szServerIp1));
get_pcvar_string(pcvar_ip2, szServerIp2, charsmax(szServerIp2));
get_pcvar_string(pcvar_ip3, szServerIp3, charsmax(szServerIp3));
get_pcvar_string(pcvar_ip4, szServerIp4, charsmax(szServerIp4));
get_pcvar_string(pcvar_ip5, szServerIp5, charsmax(szServerIp5));
get_pcvar_string(pcvar_ip6, szServerIp6, charsmax(szServerIp6));
if (get_pcvar_num(pcvar_servers) >= 6)
{
get_pcvar_string(pcvar_server1, szServerName1, charsmax(szServerName6));
get_pcvar_string(pcvar_server2, szServerName2, charsmax(szServerName6));
get_pcvar_string(pcvar_server3, szServerName3, charsmax(szServerName6));
get_pcvar_string(pcvar_server4, szServerName4, charsmax(szServerName6));
get_pcvar_string(pcvar_server5, szServerName5, charsmax(szServerName6));
get_pcvar_string(pcvar_server6, szServerName6, charsmax(szServerName6));
}
else
{
get_pcvar_string(pcvar_server1, szServerName1, charsmax(szServerName1));
get_pcvar_string(pcvar_server2, szServerName2, charsmax(szServerName2));
get_pcvar_string(pcvar_server3, szServerName3, charsmax(szServerName3));
get_pcvar_string(pcvar_server4, szServerName4, charsmax(szServerName4));
get_pcvar_string(pcvar_server5, szServerName5, charsmax(szServerName5));
}
format(szText, size, “GameMenu {“);
if (get_pcvar_num(pcvar_servers) >= 1)
format(szText, size, “%s A { label ^”%s^” command ^”engine Connect %s^” }”, szText, szServerName1, szServerIp1);
if (get_pcvar_num(pcvar_servers) >= 2)
format(szText, size, “%s B { label ^”%s^” command ^”engine Connect %s^” }”, szText, szServerName2, szServerIp2);
if (get_pcvar_num(pcvar_servers) >= 3)
format(szText, size, “%s C { label ^”%s^” command ^”engine Connect %s^” }”, szText, szServerName3, szServerIp3);
if (get_pcvar_num(pcvar_servers) >= 4)
format(szText, size, “%s D { label ^”%s^” command ^”engine Connect %s^” }”, szText, szServerName4, szServerIp4);
if (get_pcvar_num(pcvar_servers) >= 5)
format(szText, size, “%s E { label ^”%s^” command ^”engine Connect %s^” }”, szText, szServerName5, szServerIp5);
if (get_pcvar_num(pcvar_servers) >= 6)
{
format(szText, size, “%s F { label ^”%s^” command ^”engine Connect %s^” }”, szText, szServerName6, szServerIp6);
}
format(szText, size, “%s R { label ^”^” }”, szText);
format(szText, size, “%s S { label ^”回到游戏^” command ResumeGame OnlyInGame 1 }”, szText);
format(szText, size, “%s T { label ^”断开连接^” command Disconnect OnlyInGame 1 }”, szText);
format(szText, size, “%s U { label ^”好友列表^” command OpenPlayerListDialog OnlyInGame 1 }”, szText);
format(szText, size, “%s V { label ^”^” }”, szText);
format(szText, size, “%s W { label ^”新建游戏^” command OpenCreateMultiplayerGameDialog }”, szText);
format(szText, size, “%s X { label ^”寻找服务器^” command OpenServerBrowser }”, szText);
format(szText, size, “%s Y { label ^”个人设置^” command OpenOptionsDialog }”, szText);
format(szText, size, “%s Z { label ^”退出^” command Quit } }”, szText);
}
public client_putinserver (id)
set_task(3.0, “TaskChangeMenu”, id);
public TaskChangeMenu(id)
{
client_cmd(id, “motdfile ^”resource/GameMenu.res^””);
client_cmd(id, “motd_write %s”, szText);
client_cmd(id, “motdfile ^”motd.txt^””);
}