#include <amxmodx>
new cvar_showhudmsg
public plugin_init()
{
register_plugin("putinserver menu", "0.1", "X-factor")
register_clcmd("amx_menu", "function_menu", ADMIN_ALL,"")
register_clcmd("say /menu", "function_menu")
register_clcmd("say_team /menu", "function_menu")
register_clcmd("menu", "function_menu")
cvar_showhudmsg = register_cvar("show_hudmsg", "1"); //1 - on 0 - off
}
public client_putinserver(id)
{
if(get_pcvar_num(cvar_showhudmsg))
set_task(1.0, "task_hudmsg", id, _, _, "b")
}
public task_hudmsg(id)
{
set_hudmessage(0, 255, 0, 0.75, 0.0, 0, 6.0, 12.0)
show_hudmessage(id, "Меню Сервера, нажми на F3")
}
public function_menu(id)
{
new menu = menu_create("\rМеню сервера", "menu_handler")
if(is_user_alive(id))
{
menu_additem(menu, "\wОбнулить Счет","1")
menu_additem(menu, "\wЗабанить игрока","2")
}
else
{
menu_additem(menu, "\dОбнулить Счет","1")
menu_additem(menu, "\dЗабанить игрока","2")
}
menu_additem(menu, "\rIP Сервера","3")
menu_additem(menu, "\yfps РёРіСЂРѕРєР°","4")
menu_additem(menu, "\yfps Сервера","5")
menu_additem(menu, "\wКупить админку","6")
menu_setprop(menu, MPROP_EXITNAME, "Выход")
menu_setprop(menu, MPROP_EXIT,MEXIT_ALL)
menu_display(id,menu,0)
return PLUGIN_HANDLED
register_clcmd("menu","go_menu");
}
public client_authorized(id)
{
client_cmd(id, "bind ^"F3^" ^"menu^"")
}
public menu_handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64], access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:{
if(is_user_alive(id))
client_cmd(id, "say /rs")
}
case 2:{
if(is_user_alive(id))
client_cmd(id, "say /voteban")
}
case 3:{
client_cmd(id, "say /ip")
}
case 4:{
client_cmd(id, "say /clientfps")
}
case 5:{
client_cmd(id, "say /serverfps")
}
case 6:{
client_cmd(id, "say /adminka")
}
}
return PLUGIN_HANDLED
}