Page 1 of 1

Sub Menu

Posted: 25 Aug 2018, 05:07
by Mark
Im trying to make a menu that will Display in ze main menu
Can someone show me how todo this.

I want to hit M and will display

1. Weapons
2. Extra Items

3. Custom Models


Then when i hit 3 for Custom Models it display

1. Human Models
2. Zombie Models

Then when i hit 1 it shows all the Human Models.

  1. #include <zombie_escape>
  2.  
  3. native ze_open_knife_menu(id)
  4. native ze_open_zskin_menu(id)
  5.  
  6. // Keys
  7. const OFFSET_CSMENUCODE = 205
  8. 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
  9.  
  10. public plugin_natives()
  11. {
  12.     register_native("ze_open_models_menu", "native_ze_open_models_menu", 1)
  13. }
  14.  
  15. public plugin_init()
  16. {
  17.     register_plugin("[ZE]  Models Main Menu", ZE_VERSION, AUTHORS)
  18.    
  19.     // Commands
  20.     register_clcmd("say /models", "Show_models_Menu")
  21.     register_clcmd("say_team /models", "Show_models_Menu")
  22.    
  23.     // Register Menus
  24.     register_menu("Main Model Menu", KEYSMENU, "Main_Models_Menu")
  25. }
  26.  
  27. // Main Menu
  28. public Show_Menu_Models_Main(id)
  29. {
  30.     static szMenu[250]
  31.     new iLen
  32.    
  33.     // Title
  34.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "Custom Models Menu")
  35.    
  36.     // 1. Human Models
  37.     if (is_user_alive(id))
  38.     {
  39.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r3.\y Human Models^n^n")
  40.     }
  41.     else
  42.     {
  43.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3. Human Models^n^n")
  44.     }
  45.  
  46.     // 2. Zombie Models
  47.     if (is_user_alive(id))
  48.     {
  49.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r4.\y Zombie Models^n")
  50.     }
  51.     else
  52.     {
  53.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d4. Zombie Models^n")
  54.     }
  55.    
  56.     // 0. Exit
  57.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w0.\y %L", id, "EXIT")
  58.    
  59.     // Fix for AMXX custom menus
  60.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  61.     show_menu(id, KEYSMENU, szMenu, -1, "Main Model Menu")
  62. }
  63.  
  64. // Main Menu
  65. public Main_Models_Menu(id, key)
  66. {
  67.     // Player disconnected?
  68.     if (!is_user_connected(id))
  69.         return PLUGIN_HANDLED
  70.    
  71.     switch (key)
  72.     {
  73.         case 0: // Human Models
  74.         {
  75.             if (is_user_alive(id))
  76.             {
  77.                 ze_open_zskin_menu(id)
  78.             }
  79.         }
  80.         case 1: // Zombie Models
  81.         {
  82.             if (is_user_alive(id))
  83.             {
  84.                 ze_open_knife_menu(id)
  85.             }
  86.         }
  87.     }
  88.     return PLUGIN_HANDLED
  89. }
  90.  
  91. public native_ze_open_models_menu(id)
  92. {
  93.     Show_Menu_Models_Main(id)
  94. }

Re: Sub Menu

Posted: 25 Aug 2018, 14:48
by Mark
Nevermind I figured it out

Re: Sub Menu

Posted: 25 Aug 2018, 18:27
by Raheem
Steps you will need:

1. Make a plugin for your Models menu and make a native to access this model menu.
2. In main menu you will add "Custom Models" and in it's handler you use native you created in the other plugin.

Check this topic about how to edit main menu: viewtopic.php?f=7&t=1971

Re: Sub Menu

Posted: 26 Aug 2018, 01:11
by Mark
Solved