weapons_menu error and no working add extra items

Coding Help/Re-API Supported
Post Reply
alynutz
Member
Member
Romania
Posts: 2
Joined: 3 Years Ago
Has thanked: 1 time
Been thanked: 0
Contact:

weapons_menu error and no working add extra items

#1

Post by alynutz » 1 Month Ago

Image
P.S I looked at that topic which was that tutorial but I didn't really understand
I want to add this weapons in ze_weapon_menu and it does not work 2 Items and I do not know with natives...

////////////////////////////
Cyclone 35 LVL | LINK -> viewtopic.php?f=14&t=2761
Paint Ball Gun 40 LVL | LINK -> viewtopic.php?f=14&t=3433
Watergun 45 LVL | LINK -> viewtopic.php?f=14&t=3464
Coil Gun 50 LVL | LINK -> viewtopic.php?f=14&t=271
Blaster SFGun 55 LVL | LINK -> viewtopic.php?f=14&t=3680
AK47 Paladin 60 LVL | LINK -> viewtopic.php?f=14&t=267
M4A1 Dark Knight | 65 LVL | LINK -> viewtopic.php?f=14&t=268
Vulcanus-1 LVL 75 | LINK -> viewtopic.php?f=14&t=185
MP5 Barlog III LVL 80 | LINK -> viewtopic.php?f=14&t=287&p=1374&hilit=Barlog+III#p1374
Barlog Ethereal LVL 90 | LINK -> viewtopic.php?f=14&t=301
Lycanthrope LVL 100 | LINK -> viewtopic.php?f=14&t=181
if you add this items in ze_weapon_menu please.....

MY ZE_WEAPON_MENU.SMA
  1. #include <zombie_escape>
  2. #include <ze_levels>
  3.  
  4. native give_golden_m3(id);
  5. native give_golden_mp5(id);
  6. native give_golden_m4a1(id);
  7. native give_golden_ak47(id);
  8. native give_sfpistol(id);
  9. native Get_MyWeapon[id];
  10.  
  11. // Setting File
  12. new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"
  13.  
  14. // Keys
  15. 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
  16. const OFFSET_CSMENUCODE = 205
  17.  
  18. // Primary Weapons Entities [Default Values]
  19. new const szPrimaryWeaponEnt[][] =
  20. {
  21.     "weapon_xm1014",  // Level 0
  22.     "weapon_ump45",   // Level 0
  23.     "weapon_m3",      // Level 1
  24.     "weapon_mp5navy", // Level 2
  25.     "weapon_p90",     // Level 3
  26.     "weapon_galil",   // Level 4
  27.     "weapon_famas",   // Level 5
  28.     "weapon_sg550",   // Level 6
  29.     "weapon_g3sg1",   // Level 7
  30.     "weapon_m249",    // Level 8
  31.     "weapon_sg552",   // Level 9
  32.     "weapon_aug",     // Level 10
  33.     "weapon_m4a1",    // Level 11
  34.     "weapon_ak47"     // Level 12
  35. }
  36.  
  37. // Secondary Weapons Entities [Default Values]
  38. new const szSecondaryWeaponEnt[][]=
  39. {
  40.     "weapon_usp",         // Level 0
  41.     "weapon_p228",        // Level 0
  42.     "weapon_glock18",     // Level 1
  43.     "weapon_fiveseven",   // Level 2
  44.     "weapon_deagle",      // Level 3
  45.     "weapon_elite"        // Level 4
  46. }
  47.  
  48. // Primary and Secondary Weapons Names [Default Values]
  49. new const szWeaponNames[][] =
  50. {
  51.     "",
  52.     "P228",
  53.     "",
  54.     "Scout",
  55.     "HE Grenade",
  56.     "XM1014",
  57.     "",
  58.     "MAC-10",
  59.     "AUG",
  60.     "Smoke Grenade",
  61.     "Dual Elite",
  62.     "Five Seven",
  63.     "UMP 45",
  64.     "SG-550",
  65.     "Galil",
  66.     "Famas",
  67.     "USP",
  68.     "Glock",
  69.     "AWP",
  70.     "MP5",
  71.     "M249",
  72.     "M3",
  73.     "M4A1",
  74.     "TMP",
  75.     "G3SG1",
  76.     "Flashbang",
  77.     "Desert Eagle",
  78.     "SG-552",
  79.     "AK-47",
  80.     "",
  81.     "P90"
  82. }
  83.  
  84. // Max Back Clip Ammo (Change it From here if you need)
  85. new const szMaxBPAmmo[] =
  86. {
  87.     -1,
  88.     52,
  89.     -1,
  90.     90,
  91.     1,
  92.     32,
  93.     1,
  94.     100,
  95.     90,
  96.     1,
  97.     120,
  98.     100,
  99.     100,
  100.     90,
  101.     90,
  102.     90,
  103.     100,
  104.     120,
  105.     30,
  106.     120,
  107.     200,
  108.     32,
  109.     90,
  110.     120,
  111.     90,
  112.     2,
  113.     35,
  114.     90,
  115.     90,
  116.     -1,
  117.     100
  118. }
  119.  
  120. // Menu selections
  121. const MENU_KEY_AUTOSELECT = 7
  122. const MENU_KEY_BACK = 7
  123. const MENU_KEY_NEXT = 8
  124. const MENU_KEY_EXIT = 9
  125.  
  126. // Variables
  127. new Array:g_szPrimaryWeapons, Array:g_szSecondaryWeapons
  128.  
  129. new g_iMenuData[33][4],
  130.     Float:g_fBuyTimeStart[33],
  131.     bool:g_bBoughtPrimary[33],
  132.     bool:g_bBoughtSecondary[33],
  133.     WPN_MAXIDS[33]
  134.  
  135. // Define
  136. #define WPN_STARTID g_iMenuData[id][0]
  137. #define WPN_SELECTION (g_iMenuData[id][0]+key)
  138. #define WPN_AUTO_ON g_iMenuData[id][1]
  139. #define WPN_AUTO_PRI g_iMenuData[id][2]
  140. #define WPN_AUTO_SEC g_iMenuData[id][3]
  141.  
  142. // Cvars
  143. new g_pCvarBuyTime,
  144.     g_pCvarHeGrenade,
  145.     g_pCvarSmokeGrenade,
  146.     g_pCvarFlashGrenade,
  147.     g_pCvarBlockWeapLowLevel
  148.  
  149. public plugin_natives()
  150. {
  151.     register_native("ze_show_weapon_menu", "native_ze_show_weapon_menu", 1)
  152.     register_native("ze_is_auto_buy_enabled", "native_ze_is_auto_buy_enabled", 1)
  153.     register_native("ze_disable_auto_buy", "native_ze_disable_auto_buy", 1)
  154. }
  155.  
  156. public plugin_precache()
  157. {
  158.     // Initialize arrays (32 is the max length of Weapon Entity like: weapon_ak47)
  159.     g_szPrimaryWeapons = ArrayCreate(32, 1)
  160.     g_szSecondaryWeapons = ArrayCreate(32, 1)
  161.    
  162.     // Load from external file
  163.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapons Menu", "PRIMARY", g_szPrimaryWeapons)
  164.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapons Menu", "SECONDARY", g_szSecondaryWeapons)
  165.    
  166.     // If we couldn't load from file, use and save default ones
  167.    
  168.     new iIndex
  169.    
  170.     if (ArraySize(g_szPrimaryWeapons) == 0)
  171.     {
  172.         for (iIndex = 0; iIndex < sizeof szPrimaryWeaponEnt; iIndex++)
  173.             ArrayPushString(g_szPrimaryWeapons, szPrimaryWeaponEnt[iIndex])
  174.        
  175.         // If not found .ini File Create it and save default values in it
  176.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapons Menu", "PRIMARY", g_szPrimaryWeapons)
  177.     }
  178.    
  179.     if (ArraySize(g_szSecondaryWeapons) == 0)
  180.     {
  181.         for (iIndex = 0; iIndex < sizeof szSecondaryWeaponEnt; iIndex++)
  182.             ArrayPushString(g_szSecondaryWeapons, szSecondaryWeaponEnt[iIndex])
  183.        
  184.         // If not found .ini File Create it and save default values in it
  185.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapons Menu", "SECONDARY", g_szSecondaryWeapons)
  186.     }
  187. }
  188.  
  189. public plugin_init()
  190. {
  191.     register_plugin("[ZE] Levels Weapons Menu", "1.1", "Raheem")
  192.    
  193.     // Commands
  194.     register_clcmd("guns", "Cmd_Buy")
  195.     register_clcmd("say /enable", "Cmd_Enable")
  196.     register_clcmd("say_team /enable", "Cmd_Enable")
  197.    
  198.     // Cvars
  199.     g_pCvarBuyTime = register_cvar("ze_buy_time", "60")
  200.     g_pCvarHeGrenade = register_cvar("ze_give_HE_nade", "1") // 0 Nothing || 1 Give HE
  201.     g_pCvarSmokeGrenade = register_cvar("ze_give_SM_nade", "1")
  202.     g_pCvarFlashGrenade = register_cvar("ze_give_FB_nade", "1")
  203.     g_pCvarBlockWeapLowLevel = register_cvar("ze_block_weapons_lowlvl", "1")
  204.    
  205.     // Menus
  206.     register_menu("Primary Weapons", KEYSMENU, "Menu_Buy_Primary")
  207.     register_menu("Secondary Weapons", KEYSMENU, "Menu_Buy_Secondary")
  208.    
  209.     // Hams
  210.     RegisterHam(Ham_Touch, "weaponbox", "Fw_TouchWeapon_Pre", 0)
  211.     RegisterHam(Ham_Touch, "armoury_entity", "Fw_TouchWeapon_Pre", 0)
  212. }
  213.  
  214. public client_disconnected(id)
  215. {
  216.     WPN_AUTO_ON = 0
  217.     WPN_STARTID = 0
  218. }
  219.  
  220. public Cmd_Enable(id)
  221. {
  222.     if (WPN_AUTO_ON)
  223.     {
  224.         ze_colored_print(id, "%L", LANG_PLAYER, "BUY_ENABLED")
  225.         WPN_AUTO_ON = 0
  226.     }
  227. }
  228.  
  229. public Cmd_Buy(id)
  230. {
  231.     // Player Zombie
  232.     if (ze_is_user_zombie(id))
  233.     {
  234.         ze_colored_print(id, "%L", LANG_PLAYER, "NO_BUY_ZOMBIE")
  235.         return
  236.     }
  237.    
  238.     // Player Dead
  239.     if (!is_user_alive(id))
  240.     {
  241.         ze_colored_print(id, "%L", LANG_PLAYER, "DEAD_CANT_BUY_WEAPON")
  242.         return
  243.     }
  244.    
  245.     // Already bought
  246.     if (g_bBoughtPrimary[id] && g_bBoughtSecondary[id])
  247.     {
  248.         ze_colored_print(id, "%L", LANG_PLAYER, "ALREADY_BOUGHT")
  249.     }
  250.    
  251.     Show_Available_Buy_Menus(id)
  252. }
  253.  
  254. public ze_user_humanized(id)
  255. {
  256.     // Static Values
  257.     switch (ze_get_user_level(id))
  258.     {
  259.         case 0: WPN_MAXIDS[id] = 2
  260.         case 1: WPN_MAXIDS[id] = 3
  261.         case 2: WPN_MAXIDS[id] = 4
  262.         case 3: WPN_MAXIDS[id] = 5
  263.         case 4: WPN_MAXIDS[id] = 6
  264.         case 5: WPN_MAXIDS[id] = 7
  265.         case 6: WPN_MAXIDS[id] = 8
  266.         case 7: WPN_MAXIDS[id] = 9
  267.         case 8: WPN_MAXIDS[id] = 10
  268.         case 9: WPN_MAXIDS[id] = 11
  269.         case 10: WPN_MAXIDS[id] = 12
  270.         case 11: WPN_MAXIDS[id] = 13
  271.         case 12..14: WPN_MAXIDS[id] = 14
  272.         case 15..19: WPN_MAXIDS[id] = 15 // Golden m3
  273.         case 20..24: WPN_MAXIDS[id] = 16 // Golden MP5
  274.         case 25..29: WPN_MAXIDS[id] = 17 // Golden M4A1
  275.         case 30: WPN_MAXIDS[id] = 18     // Golden AK47
  276.         case 31: WPN_MAXIDS[id] = 19     // Cyclone
  277.         case 32: WPN_MAXIDS[id] = 19     // Paint Ball Gun
  278.     }
  279.    
  280.     if (ze_get_user_level(id) > 30)
  281.     {
  282.         WPN_MAXIDS[id] = 18
  283.     }
  284.  
  285.     // Buyzone time starts when player is set to human
  286.     g_fBuyTimeStart[id] = get_gametime()
  287.    
  288.     g_bBoughtPrimary[id] = false
  289.     g_bBoughtSecondary[id] = false
  290.    
  291.     // Player dead or zombie
  292.     if (!is_user_alive(id) || ze_is_user_zombie(id))
  293.         return
  294.    
  295.     if (WPN_AUTO_ON)
  296.     {
  297.         ze_colored_print(id, "%L", LANG_PLAYER, "RE_ENABLE_MENU")
  298.         Buy_Primary_Weapon(id, WPN_AUTO_PRI)
  299.         Buy_Secondary_Weapon(id, WPN_AUTO_SEC)
  300.     }
  301.    
  302.     // Open available buy menus
  303.     Show_Available_Buy_Menus(id)
  304.    
  305.     // Give HE Grenade
  306.     if (get_pcvar_num(g_pCvarHeGrenade) != 0)
  307.         rg_give_item(id, "weapon_hegrenade")
  308.    
  309.     // Give Smoke Grenade
  310.     if (get_pcvar_num(g_pCvarSmokeGrenade) != 0)
  311.         rg_give_item(id, "weapon_smokegrenade")
  312.    
  313.     // Give Flashbang Grenade
  314.     if (get_pcvar_num(g_pCvarFlashGrenade) != 0)
  315.         rg_give_item(id, "weapon_flashbang")
  316. }
  317.  
  318. public Show_Available_Buy_Menus(id)
  319. {
  320.     // Already Bought
  321.     if (g_bBoughtPrimary[id] && g_bBoughtSecondary[id])
  322.         return
  323.    
  324.     // Here we use if and else if so we make sure that Primary weapon come first then secondary
  325.     if (!g_bBoughtPrimary[id])
  326.     {
  327.         // Primary     
  328.         Show_Menu_Buy_Primary(id)
  329.     }
  330.     else if (!g_bBoughtSecondary[id])
  331.     {
  332.         // Secondary
  333.         Show_Menu_Buy_Secondary(id)
  334.     }
  335. }
  336.  
  337. public Show_Menu_Buy_Primary(id)
  338. {
  339.     new iMenuTime = floatround(g_fBuyTimeStart[id] + get_pcvar_float(g_pCvarBuyTime) - get_gametime())
  340.    
  341.     if (iMenuTime <= 0)
  342.     {
  343.         ze_colored_print(id, "%L", id, "BUY_MENU_TIME_EXPIRED")
  344.         return
  345.     }
  346.    
  347.     static szMenu[300], szWeaponName[32]
  348.     new iLen, iIndex, iMaxLoops = min(WPN_STARTID+7, WPN_MAXIDS[id])
  349.    
  350.     // Title
  351.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y%L \w[\r%d\w-\r%d\w]^n^n", id, "MENU_PRIMARY_TITLE", WPN_STARTID+1, min(WPN_STARTID+7, WPN_MAXIDS[id]))
  352.    
  353.     // 1-7. Weapon List
  354.     for (iIndex = WPN_STARTID; iIndex < iMaxLoops; iIndex++)
  355.     {
  356.         if (ze_get_user_level(id) == 0 && iIndex >= 2||
  357.         ze_get_user_level(id) == 1 && iIndex >= 3 ||
  358.         ze_get_user_level(id) == 2 && iIndex >= 4 ||
  359.         ze_get_user_level(id) == 3 && iIndex >= 5 ||
  360.         ze_get_user_level(id) == 4 && iIndex >= 6 ||
  361.         ze_get_user_level(id) == 5 && iIndex >= 7 ||
  362.         ze_get_user_level(id) == 6 && iIndex >= 8 ||
  363.         ze_get_user_level(id) == 7 && iIndex >= 9 ||
  364.         ze_get_user_level(id) == 8 && iIndex >= 10 ||
  365.         ze_get_user_level(id) == 9 && iIndex >= 11 ||
  366.         ze_get_user_level(id) == 10 && iIndex >= 12 ||
  367.         ze_get_user_level(id) == 11 && iIndex >= 13 ||
  368.         ze_get_user_level(id) == 12 && iIndex >= 14)
  369.         {
  370.             break
  371.         }
  372.        
  373.         /*
  374.         *  Note that WPN_MAXIDS start from 1 but iIndex start from 0.
  375.         */
  376.        
  377.         // Golden M3
  378.         if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 20)
  379.         {
  380.             if (iIndex == 14)
  381.             {
  382.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden M3")
  383.                 break;
  384.             }
  385.         }
  386.        
  387.         // Golden MP5
  388.         if (ze_get_user_level(id) >= 20 && ze_get_user_level(id) < 25)
  389.         {
  390.             if (iIndex == 14)
  391.             {
  392.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden M3")
  393.             }
  394.            
  395.             if (iIndex == 15)
  396.             {
  397.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden MP5")
  398.                 break;
  399.             }
  400.         }
  401.        
  402.         // Golden M4A1
  403.         if (ze_get_user_level(id) >= 25 && ze_get_user_level(id) < 30)
  404.         {
  405.             if (iIndex == 14)
  406.             {
  407.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden M3")
  408.             }
  409.            
  410.             if (iIndex == 15)
  411.             {
  412.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden MP5")
  413.             }
  414.            
  415.             if (iIndex == 16)
  416.             {
  417.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden M4A1")
  418.                 break;
  419.             }
  420.         }
  421.        
  422.         // Golden AK47
  423.         if (ze_get_user_level(id) >= 30)
  424.         {
  425.             if (iIndex == 14)
  426.             {
  427.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden M3")
  428.             }
  429.            
  430.             if (iIndex == 15)
  431.             {
  432.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden MP5")
  433.             }
  434.            
  435.             if (iIndex == 16)
  436.             {
  437.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden M4A1")
  438.             }
  439.            
  440.             if (iIndex == 17)
  441.             {
  442.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden AK-47")
  443.                 break;
  444.             }
  445.         }
  446.        
  447.        
  448.         // Cyclone
  449.         if (ze_get_user_level(id) >= 35) //35 LVL
  450.         {
  451.             if (iIndex == 18)
  452.             {
  453.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Cyclone")
  454.             }
  455.            
  456.         }
  457.                
  458.         // Paint Ball Gun
  459.         if (ze_get_user_level(id) >= 40) //40 LVL
  460.         {
  461.             if (iIndex == 19)
  462.             {
  463.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Paint Ball Gun")
  464.             }
  465.            
  466.         }
  467.        
  468.        
  469.         // Must check if iIndex < 14 means max is AK47
  470.         if (iIndex < 14)
  471.         {
  472.             ArrayGetString(g_szPrimaryWeapons, iIndex, szWeaponName, charsmax(szWeaponName))
  473.             iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, szWeaponNames[get_weaponid(szWeaponName)])
  474.         }
  475.     }
  476.    
  477.     if (iIndex < 7)
  478.     {
  479.         ArrayGetString(g_szPrimaryWeapons, iIndex, szWeaponName, charsmax(szWeaponName))
  480.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  481.     }
  482.    
  483.     if (ze_get_user_level(id) == 5)
  484.     {
  485.         ArrayGetString(g_szPrimaryWeapons, 7, szWeaponName, charsmax(szWeaponName))
  486.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  487.     }
  488.     else if (ze_get_user_level(id) == 6)
  489.     {
  490.         ArrayGetString(g_szPrimaryWeapons, 8, szWeaponName, charsmax(szWeaponName))
  491.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  492.     }
  493.     else if (ze_get_user_level(id) == 7)
  494.     {
  495.         ArrayGetString(g_szPrimaryWeapons, 9, szWeaponName, charsmax(szWeaponName))
  496.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  497.     }
  498.     else if (ze_get_user_level(id) == 8)
  499.     {
  500.         ArrayGetString(g_szPrimaryWeapons, 10, szWeaponName, charsmax(szWeaponName))
  501.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  502.     }
  503.     else if (ze_get_user_level(id) == 9)
  504.     {
  505.         ArrayGetString(g_szPrimaryWeapons, 11, szWeaponName, charsmax(szWeaponName))
  506.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  507.     }
  508.     else if (ze_get_user_level(id) == 10)
  509.     {
  510.         ArrayGetString(g_szPrimaryWeapons, 12, szWeaponName, charsmax(szWeaponName))
  511.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  512.     }
  513.     else if (ze_get_user_level(id) == 11)
  514.     {
  515.         ArrayGetString(g_szPrimaryWeapons, 13, szWeaponName, charsmax(szWeaponName))
  516.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  517.     }
  518.     else if (ze_get_user_level(id) >= 12 && ze_get_user_level(id) < 15) // Golden M3
  519.     {
  520.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Level 15 Unlock\w: \yGolden M3^n")
  521.     }
  522.     else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 20) // Golden MP5
  523.     {
  524.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Level 20 Unlock\w: \yGolden MP5^n")
  525.     }
  526.     else if (ze_get_user_level(id) >= 20 && ze_get_user_level(id) < 25) // Golden M4A1
  527.     {
  528.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Level 25 Unlock\w: \yGolden M4A1^n")
  529.     }
  530.     else if (ze_get_user_level(id) >= 25 && ze_get_user_level(id) < 30) // Golden Ak-47
  531.     {
  532.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Level 30 Unlock\w: \yGolden AK-47^n")
  533.     }
  534.     else if (ze_get_user_level(id) >= 30 && ze_get_user_level(id) < 35) // Cyclone
  535.     {
  536.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Level 35 Unlock\w: \yCyclone^n")
  537.     }
  538.     else if (ze_get_user_level(id) >= 35 && ze_get_user_level(id) < 40) // Paint Ball Gun
  539.     {
  540.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Level 40 Unlock\w: \yPaint Ball Gun^n")
  541.     }
  542.  
  543.     // 8. Auto Select
  544.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\w8.\y %L \w[\r%L\w]", id, "MENU_AUTOSELECT", id, (WPN_AUTO_ON) ? "SAVE_YES" : "SAVE_NO")
  545.    
  546.     // 9. Next/Back - 0. Exit
  547.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\y9.\r %L \w/ \r%L^n^n\w0.\y %L", id, "NEXT", id, "BACK", id, "EXIT")
  548.    
  549.     // Fix for AMXX custom menus
  550.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  551.     show_menu(id, KEYSMENU, szMenu, iMenuTime, "Primary Weapons")
  552. }
  553.  
  554. public Show_Menu_Buy_Secondary(id)
  555. {
  556.     new iMenuTime = floatround(g_fBuyTimeStart[id] + get_pcvar_float(g_pCvarBuyTime) - get_gametime())
  557.    
  558.     if (iMenuTime <= 0)
  559.     {
  560.         ze_colored_print(id, "%L", id, "BUY_MENU_TIME_EXPIRED")
  561.         return
  562.     }
  563.    
  564.     static szMenu[250], szWeaponName[32]
  565.     new iLen, iIndex, iMaxLoops = ArraySize(g_szSecondaryWeapons)
  566.    
  567.     // Title
  568.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y%L^n", id, "MENU_SECONDARY_TITLE")
  569.    
  570.     // 1-6. Weapon List
  571.     for (iIndex = 0; iIndex < iMaxLoops; iIndex++)
  572.     {
  573.         if (ze_get_user_level(id) == 0 && iIndex >= 2 ||
  574.         ze_get_user_level(id) == 1 && iIndex >= 3 ||
  575.         ze_get_user_level(id) == 2 && iIndex >= 4 ||
  576.         ze_get_user_level(id) == 3 && iIndex >= 5 ||
  577.         ze_get_user_level(id) == 4 && iIndex >= 6)
  578.         {
  579.             break
  580.         }
  581.        
  582.         ArrayGetString(g_szSecondaryWeapons, iIndex, szWeaponName, charsmax(szWeaponName))
  583.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\w%d.\y %s", iIndex+1, szWeaponNames[get_weaponid(szWeaponName)])
  584.     }
  585.    
  586.     if (iIndex < ArraySize(g_szSecondaryWeapons))
  587.     {
  588.         ArrayGetString(g_szSecondaryWeapons, iIndex, szWeaponName, charsmax(szWeaponName))
  589.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\r Next Level Unlock\w: \y%s", szWeaponNames[get_weaponid(szWeaponName)])
  590.     }
  591.    
  592.     // 8. Auto Select
  593.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w8.\y %L \w[\r%L\w]", id, "MENU_AUTOSELECT", id, (WPN_AUTO_ON) ? "SAVE_YES" : "SAVE_NO")
  594.    
  595.     // 0. Exit
  596.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w0.\y %L", id, "EXIT")
  597.    
  598.     // Fix for AMXX custom menus
  599.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  600.     show_menu(id, KEYSMENU, szMenu, iMenuTime, "Secondary Weapons")
  601. }
  602.  
  603. public Menu_Buy_Primary(id, key)
  604. {
  605.     // Player dead or zombie or already bought primary
  606.     if (!is_user_alive(id) || ze_is_user_zombie(id) || g_bBoughtPrimary[id])
  607.         return PLUGIN_HANDLED
  608.    
  609.     // Special keys / weapon list exceeded
  610.     if (key >= MENU_KEY_AUTOSELECT || WPN_SELECTION >= WPN_MAXIDS[id])
  611.     {
  612.         switch (key)
  613.         {
  614.             case MENU_KEY_AUTOSELECT: // toggle auto select
  615.             {
  616.                 WPN_AUTO_ON = 1 - WPN_AUTO_ON
  617.             }
  618.             case MENU_KEY_NEXT: // next/back
  619.             {
  620.                 if (WPN_STARTID+7 < WPN_MAXIDS[id])
  621.                     WPN_STARTID += 7
  622.                 else
  623.                     WPN_STARTID = 0
  624.             }
  625.             case MENU_KEY_EXIT: // exit
  626.             {
  627.                 return PLUGIN_HANDLED
  628.             }
  629.         }
  630.        
  631.         // Show buy menu again
  632.         Show_Menu_Buy_Primary(id)
  633.         return PLUGIN_HANDLED
  634.     }
  635.    
  636.     // Store selected weapon id
  637.     WPN_AUTO_PRI = WPN_SELECTION
  638.    
  639.     // Buy primary weapon
  640.     Buy_Primary_Weapon(id, WPN_AUTO_PRI)
  641.    
  642.     // Show Secondary Weapons
  643.     Show_Available_Buy_Menus(id)
  644.    
  645.     return PLUGIN_HANDLED
  646. }
  647.  
  648. public Buy_Primary_Weapon(id, selection)
  649. {
  650.     if (selection == 14) // Golden M3
  651.     {
  652.         give_golden_m3(id)
  653.         g_bBoughtPrimary[id] = true
  654.         return true;
  655.     }
  656.     else if (selection == 15) // Golden MP5
  657.     {
  658.         give_golden_mp5(id)
  659.         g_bBoughtPrimary[id] = true
  660.         return true;
  661.     }
  662.     else if (selection == 16) // Golden M4A1
  663.     {
  664.         give_golden_m4a1(id)
  665.         g_bBoughtPrimary[id] = true
  666.         return true;
  667.     }
  668.     else if (selection == 17) // Golden AK47
  669.     {
  670.         give_golden_ak47(id)
  671.         g_bBoughtPrimary[id] = true
  672.         return true;
  673.     }
  674.     else if (selection == 18) // Cyclone
  675.     {
  676.         give_sfpistol(id)
  677.         g_bBoughtPrimary[id] = true
  678.         return true;
  679.     }
  680.     else if (selection == 19) // Paint Ball Gun
  681.     {
  682.         g_paintball_gun[id]
  683.         g_bBoughtPrimary[id] = true
  684.         return true;
  685.     }
  686.    
  687.    
  688.     static szWeaponName[32]
  689.     ArrayGetString(g_szPrimaryWeapons, selection, szWeaponName, charsmax(szWeaponName))
  690.     new iWeaponId = get_weaponid(szWeaponName)
  691.    
  692.     // Strip and Give Full Weapon
  693.     rg_give_item(id, szWeaponName, GT_REPLACE)
  694.     rg_set_user_bpammo(id, WeaponIdType:iWeaponId, szMaxBPAmmo[iWeaponId])
  695.    
  696.     // Primary bought
  697.     g_bBoughtPrimary[id] = true
  698.     return true;
  699. }
  700.  
  701. public Menu_Buy_Secondary(id, key)
  702. {
  703.     // Player dead or zombie or already bought secondary
  704.     if (!is_user_alive(id) || ze_is_user_zombie(id) || g_bBoughtSecondary[id])
  705.         return PLUGIN_HANDLED
  706.    
  707.     // Special keys / weapon list exceeded
  708.     if (key >= ArraySize(g_szSecondaryWeapons))
  709.     {
  710.         // Toggle autoselect
  711.         if (key == MENU_KEY_AUTOSELECT)
  712.             WPN_AUTO_ON = 1 - WPN_AUTO_ON
  713.        
  714.         // Reshow menu unless user exited
  715.         if (key != MENU_KEY_EXIT)
  716.             Show_Menu_Buy_Secondary(id)
  717.        
  718.         return PLUGIN_HANDLED
  719.     }
  720.    
  721.     // Store selected weapon id
  722.     WPN_AUTO_SEC = key
  723.    
  724.     // Buy secondary weapon
  725.     Buy_Secondary_Weapon(id, key)
  726.    
  727.     return PLUGIN_HANDLED
  728. }
  729.  
  730. public Buy_Secondary_Weapon(id, selection)
  731. {
  732.     if ( ((selection == 2) && (ze_get_user_level(id) < 1)) ||
  733.     ((selection == 3) && (ze_get_user_level(id) < 2)) ||
  734.     ((selection == 4) && (ze_get_user_level(id) < 3)) ||
  735.     ((selection == 5) && (ze_get_user_level(id) < 4)) )
  736.     {
  737.         Show_Menu_Buy_Secondary(id)
  738.         return;
  739.     }
  740.  
  741.     static szWeaponName[32]
  742.     ArrayGetString(g_szSecondaryWeapons, selection, szWeaponName, charsmax(szWeaponName))
  743.     new iWeaponId = get_weaponid(szWeaponName)
  744.    
  745.     // Strip and Give Full Weapon
  746.     rg_give_item(id, szWeaponName, GT_REPLACE)
  747.     rg_set_user_bpammo(id, WeaponIdType:iWeaponId, szMaxBPAmmo[iWeaponId])
  748.    
  749.     // Secondary bought
  750.     g_bBoughtSecondary[id] = true
  751. }
  752.  
  753. public Fw_TouchWeapon_Pre(iEnt, id)
  754. {
  755.     if (get_pcvar_num(g_pCvarBlockWeapLowLevel) == 0)
  756.         return HAM_IGNORED;
  757.    
  758.     // Not alive or Not Valid Weapon?
  759.     if(!is_user_alive(id) || !pev_valid(iEnt))
  760.         return HAM_IGNORED;
  761.    
  762.     // Get Weapon Model
  763.     new szWeapModel[32]
  764.     pev(iEnt, pev_model, szWeapModel, charsmax(szWeapModel))
  765.    
  766.     // Remove "models/w_" and ".mdl"
  767.     copyc(szWeapModel, charsmax(szWeapModel), szWeapModel[contain(szWeapModel, "_" ) + 1], '.')
  768.    
  769.     // Set for mp5 to be same as "weapon_mp5navy"
  770.     if(szWeapModel[1] == 'p' && szWeapModel[2] == '5')
  771.         szWeapModel = "mp5navy"
  772.    
  773.     // Add "weapon_" to all model names
  774.     static szWeaponEnt[32]
  775.     formatex(szWeaponEnt, charsmax(szWeaponEnt), "weapon_%s", szWeapModel)
  776.  
  777.     // Get it's index in Weapon Array
  778.     new iIndex, i
  779.    
  780.     // I won't explain the blew code if you need to understand ask me in Escapers-Zone.XYZ
  781.     for (i = 0; i < ArraySize(g_szPrimaryWeapons); i++)
  782.     {
  783.         new szPrimaryWeapon[32]
  784.         ArrayGetString(g_szPrimaryWeapons, i, szPrimaryWeapon, charsmax(szPrimaryWeapon))
  785.        
  786.         if (equali(szWeaponEnt, szPrimaryWeapon))
  787.             iIndex = i
  788.     }
  789.    
  790.     if (ze_get_user_level(id) == 0 && iIndex > 1)
  791.     {
  792.         return HAM_SUPERCEDE;
  793.     }
  794.    
  795.     for (i = 1; i <= 11; i++)
  796.     {
  797.         if ((ze_get_user_level(id) == i) && iIndex > i+1)
  798.         {
  799.             return HAM_SUPERCEDE;
  800.         }
  801.     }
  802.    
  803.     return HAM_IGNORED;
  804. }
  805.  
  806. // Natives
  807. public native_ze_show_weapon_menu(id)
  808. {
  809.     if (!is_user_connected(id))
  810.     {
  811.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  812.         return false
  813.     }
  814.    
  815.     Cmd_Buy(id)
  816.     return true
  817. }
  818.  
  819. public native_ze_is_auto_buy_enabled(id)
  820. {
  821.     if (!is_user_connected(id))
  822.     {
  823.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  824.         return -1;
  825.     }
  826.    
  827.     return WPN_AUTO_ON;
  828. }
  829.  
  830. public native_ze_disable_auto_buy(id)
  831. {
  832.     if (!is_user_connected(id))
  833.     {
  834.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  835.         return false
  836.     }
  837.    
  838.     WPN_AUTO_ON = 0;
  839.     return true
  840. }

ngamerz
Member
Member
Philippines
Posts: 37
Joined: 8 Months Ago
Location: Philippines From South Korea
Has thanked: 1 time
Been thanked: 5 times
Contact:

#2

Post by ngamerz » 1 Month Ago

Line 9:

Code: Select all

native Get_MyWeapon[id];
-->>

Code: Select all

native Get_MyWeapon(id);
Line 682:

Code: Select all

g_paintball_gun[id]
This is variable not native, you should add the native in the weapon menu and replace this one.
My Steam:
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest