Problem in Menu Main

Coding Help/Re-API Supported
Post Reply
User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 486
Joined: 5 years ago
Location: The Red City ❤
Contact:

Re: Problem in Menu Main

#1

Post by z0h1r-LK » 1 year ago

Check now

Code :
  1. #include <zombie_escape>
  2. #include <ze_vip>
  3.  
  4. native ze_open_knife_menu(id);
  5. native ze_show_sound_menu(id);
  6.  
  7. // Keys
  8. const OFFSET_CSMENUCODE = 205
  9. const KEYSMENU = 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_9|MENU_KEY_0
  10.  
  11. public plugin_init()
  12. {
  13.     register_plugin("[ZE] Main Menu", ZE_VERSION, AUTHORS)
  14.    
  15.     // Commands
  16.     register_clcmd("chooseteam", "Cmd_ChooseTeam")
  17.     register_clcmd("say /zemenu", "Cmd_ChooseTeam")
  18.     register_clcmd("say_team /zemenu", "Cmd_ChooseTeam")
  19.    
  20.     // Register Menus
  21.     register_menu("Main Menu", KEYSMENU, "Main_Menu")
  22. }
  23.  
  24. public Cmd_ChooseTeam(id)
  25. {
  26.     if (!is_user_connected(id))
  27.         return PLUGIN_CONTINUE;
  28.  
  29.     switch (get_member(id, m_iTeam))
  30.     {
  31.         case TEAM_TERRORIST, TEAM_CT:
  32.         {
  33.             Show_Menu_Main(id)
  34.             return PLUGIN_HANDLED // Kill the Choose Team Command
  35.         }
  36.     }
  37.    
  38.     // Player in Spec? Allow him to open choose team menu so he can join
  39.     return PLUGIN_CONTINUE
  40. }
  41.  
  42. // Main Menu
  43. public Show_Menu_Main(id)
  44. {
  45.     static szMenu[250], iLen
  46.    
  47.     // Title
  48.     iLen = formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%L^n^n", id, "MAIN_MENU_TITLE")
  49.    
  50.     // 1. Buy Weapons
  51.     if (!ze_is_auto_buy_enabled(id)) // AutoBuy not enabled - normal case
  52.     {
  53.         if (is_user_alive(id))
  54.         {
  55.             iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y1.\r %L^n", id, "MENU_WEAPONBUY")
  56.         }
  57.         else
  58.         {
  59.             iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d1. %L^n", id, "MENU_WEAPONBUY")
  60.         }
  61.     }
  62.     else
  63.     {
  64.         // Auto-Buy enabled - Re-enable case
  65.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y1.\r %L^n", id, "MENU_WEAPONBUY_RE_ENABLE")
  66.     }
  67.    
  68.     // 2. Extra Items
  69.     if (is_user_alive(id))
  70.     {
  71.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y2. \r%L^n", id, "MENU_EXTRABUY")
  72.     }
  73.     else
  74.     {
  75.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. %L^n", id, "MENU_EXTRABUY")
  76.     }
  77.    
  78.     // 3. Unstuck
  79.     if (is_user_alive(id))
  80.     {
  81.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y3. \r%L^n^n", id, "MENU_UNSTUCK")
  82.     }
  83.     else
  84.     {
  85.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3. %L^n^n", id, "MENU_UNSTUCK")
  86.     }
  87.    
  88.     // 4. Camer View
  89.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y4. \rCamera View^n")
  90.  
  91.     // 5. Daily Golds
  92.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y5. \rDaily Golds^n^n")
  93.    
  94.     // 6. Random Prizes
  95.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y6. \rRandom Prizes^n")
  96.    
  97.     // 7. Admin Menu
  98.     if (get_user_flags(id) & ADMIN_KICK)
  99.     {
  100.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y7. \rAdmin Menu^n")
  101.     }
  102.     else
  103.     {
  104.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d7. Admin Menu^n")
  105.     }
  106.    
  107.     // 0. Exit
  108.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\y0.\r %L", id, "EXIT")
  109.    
  110.     // Fix for AMXX custom menus
  111.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  112.     show_menu(id, KEYSMENU, szMenu, -1, "Main Menu")
  113. }
  114.  
  115. // Main Menu
  116. public Main_Menu(id, key)
  117. {
  118.     // Player disconnected?
  119.     if (!is_user_connected(id))
  120.         return PLUGIN_HANDLED
  121.    
  122.     switch (key)
  123.     {
  124.         case 0: // Buy Weapons
  125.         {
  126.             if (!ze_is_auto_buy_enabled(id))
  127.             {
  128.                 ze_show_weapon_menu(id)
  129.             }
  130.             else
  131.             {
  132.                 ze_disable_auto_buy(id)
  133.                 Show_Menu_Main(id)
  134.             }
  135.         }
  136.         case 1: // Extra Items
  137.         {
  138.             if (is_user_alive(id))
  139.             {
  140.                 ze_show_items_menu(id)
  141.             }
  142.             else
  143.             {
  144.                 ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
  145.             }
  146.         }
  147.         case 2: // Unstuck
  148.         {
  149.             if (is_user_alive(id))
  150.             {
  151.                 client_cmd(id, "say /unstuck")
  152.             }
  153.             else
  154.             {
  155.                 ze_colored_print(id, "%L", id, "DEAD_CANT_UNSTUCK")
  156.             }
  157.         }
  158.         case 3: // Camera View
  159.         {
  160.             client_cmd(id, "say /cam")
  161.         }
  162.         case 4: // Daily Golds
  163.         {
  164.             client_cmd(id, "say /get")
  165.         }
  166.         case 5: // Random Prizes
  167.         {
  168.             client_cmd(id, "say /prize")
  169.         }
  170.         case 6: // Admin Menu
  171.         {
  172.             if (get_user_flags(id) & ADMIN_KICK)
  173.             {
  174.                 client_cmd(id, "amxmodmenu")
  175.             }
  176.             else
  177.             {
  178.                 ze_colored_print(id, "!tYou are not !gAdmin!y.")
  179.             }
  180.         }
  181.     }
  182.  
  183.     return PLUGIN_HANDLED
  184. }

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 0 guests