#include <amxmodx>
#include <amxmisc>
#include <dhudmessage>

#define PLUGIN  "Menu"
#define VERSION "1.0"
#define AUTHOR  "WaT_1"

new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_0
new cvar_showhudmsg

public plugin_init()
{
     register_plugin(PLUGIN, VERSION, AUTHOR)
     register_menu("Menu 1", keys, "func_menu") 
     register_concmd("menu", "Server_Menu")
     register_concmd("chooseteam", "Server_Menu")

     cvar_showhudmsg = register_cvar("show_hudmsg", "1");            //1 - on                0 - off
}

public client_authorized(id)
{
     client_cmd(id, "bind ^"F3^" ^"menu^"")
}

public client_putinserver(id)
{
        if(get_pcvar_num(cvar_showhudmsg))
                set_task(1.0, "task_hudmsg", id, _, _, "b")
}

public task_hudmsg(id)
{
        set_hudmessage(255, 215, 0, 0.75, 0.0, 0, 6.0, 12.0)
        show_hudmessage(id, "Меню Сервера На букву M")
}

public Server_Menu(id)
{
     new name[32]
     get_user_name(id, name, 31)
     static menu[650], iLen
     iLen = 0
     iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\yМеню Сервера^n\dУкраинский Паблик [ARMY]^n^n")

     iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r1. \wСменить команду^n")
     keys |= MENU_KEY_1

     iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r2. \wСменить карту^n")
     keys |= MENU_KEY_2

     iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r3. \wЗабанить читера^n")
     keys |= MENU_KEY_3

     iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r4. \wОбнулить счёт^n")
     keys |= MENU_KEY_4

     iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r5. \wЛучшие игроки^n")
     keys |= MENU_KEY_5

     iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r6. \wМоя статистика^n^n")
     keys |= MENU_KEY_6
     
     iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r7. \yВип Меню^n")
     keys |= MENU_KEY_7
     
     iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r8. \yАдмин Меню^n^n")
     keys |= MENU_KEY_8

     iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r0. \wВыход^n")
     keys |= MENU_KEY_0

     show_menu(id, keys, menu, -1, "Menu 1")
     return PLUGIN_HANDLED
}

public func_menu(id, key)
{
     switch(key)
     {
          case 0: client_cmd(id, "jointeam")
          case 1: client_cmd(id, "say /rtv")
          case 2: client_cmd(id, "say /voteban")
          case 3: client_cmd(id, "say /rs")
          case 4: client_cmd(id, "say /top15")
          case 5: client_cmd(id, "say /rank") 
          case 6: client_cmd(id, "say /vipmenu") 
          case 7: client_cmd(id, "amxmodmenu")
     }
     return PLUGIN_HANDLED
}
