Weapon menu Help !

Unpaid Requests, Public Plugins
Post Reply
Luxurious
Member
Member
Egypt
Posts: 89
Joined: 10 Months Ago
Location: Egypt
Has thanked: 2 times
Been thanked: 1 time
Contact:

Weapon menu Help !

#1

Post by Luxurious » 1 Week Ago

hello guys .... need to change my weapons menu to
all normal weapons without level only last 4 weapons with level

Here is my waepon menu code
  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 ze_giveminigun(id);
  8. native give_thantos5(id);
  9. native give_frost_m4a1(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.     200,
  89.     -1,
  90.     200,
  91.     1,
  92.     200,
  93.     1,
  94.     200,
  95.     200,
  96.     1,
  97.     200,
  98.     200,
  99.     200,
  100.     200,
  101.     200,
  102.     200,
  103.     200,
  104.     200,
  105.     200,
  106.     200,
  107.     200,
  108.     32,
  109.     200,
  110.     200,
  111.     200,
  112.     2,
  113.     200,
  114.     200,
  115.     200,
  116.     -1,
  117.     200
  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", "0")
  202.     g_pCvarFlashGrenade = register_cvar("ze_give_FB_nade", "0")
  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.     }
  277.    
  278.     if (ze_get_user_level(id) > 30)
  279.     {
  280.         WPN_MAXIDS[id] = 18
  281.     }
  282.  
  283.     // Buyzone time starts when player is set to human
  284.     g_fBuyTimeStart[id] = get_gametime()
  285.    
  286.     g_bBoughtPrimary[id] = false
  287.     g_bBoughtSecondary[id] = false
  288.    
  289.     // Player dead or zombie
  290.     if (!is_user_alive(id) || ze_is_user_zombie(id))
  291.         return
  292.    
  293.     if (WPN_AUTO_ON)
  294.     {
  295.         ze_colored_print(id, "%L", LANG_PLAYER, "RE_ENABLE_MENU")
  296.         Buy_Primary_Weapon(id, WPN_AUTO_PRI)
  297.         Buy_Secondary_Weapon(id, WPN_AUTO_SEC)
  298.     }
  299.    
  300.     // Open available buy menus
  301.     Show_Available_Buy_Menus(id)
  302.    
  303.     // Give HE Grenade
  304.     if (get_pcvar_num(g_pCvarHeGrenade) != 0)
  305.         rg_give_item(id, "weapon_hegrenade")
  306.    
  307.     // Give Smoke Grenade
  308.     if (get_pcvar_num(g_pCvarSmokeGrenade) != 0)
  309.         rg_give_item(id, "weapon_smokegrenade")
  310.    
  311.     // Give Flashbang Grenade
  312.     if (get_pcvar_num(g_pCvarFlashGrenade) != 0)
  313.         rg_give_item(id, "weapon_flashbang")
  314. }
  315.  
  316. public Show_Available_Buy_Menus(id)
  317. {
  318.     // Already Bought
  319.     if (g_bBoughtPrimary[id] && g_bBoughtSecondary[id])
  320.         return
  321.    
  322.     // Here we use if and else if so we make sure that Primary weapon come first then secondary
  323.     if (!g_bBoughtPrimary[id])
  324.     {
  325.         // Primary    
  326.         Show_Menu_Buy_Primary(id)
  327.     }
  328.     else if (!g_bBoughtSecondary[id])
  329.     {
  330.         // Secondary
  331.         Show_Menu_Buy_Secondary(id)
  332.     }
  333. }
  334.  
  335. public Show_Menu_Buy_Primary(id)
  336. {
  337.     new iMenuTime = floatround(g_fBuyTimeStart[id] + get_pcvar_float(g_pCvarBuyTime) - get_gametime())
  338.    
  339.     if (iMenuTime <= 0)
  340.     {
  341.         ze_colored_print(id, "%L", id, "BUY_MENU_TIME_EXPIRED")
  342.         return
  343.     }
  344.    
  345.     static szMenu[300], szWeaponName[32]
  346.     new iLen, iIndex, iMaxLoops = min(WPN_STARTID+7, WPN_MAXIDS[id])
  347.    
  348.     // Title
  349.     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]))
  350.    
  351.     // 1-7. Weapon List
  352.     for (iIndex = WPN_STARTID; iIndex < iMaxLoops; iIndex++)
  353.     {
  354.         if (ze_get_user_level(id) == 0 && iIndex >= 2||
  355.         ze_get_user_level(id) == 1 && iIndex >= 3 ||
  356.         ze_get_user_level(id) == 2 && iIndex >= 4 ||
  357.         ze_get_user_level(id) == 3 && iIndex >= 5 ||
  358.         ze_get_user_level(id) == 4 && iIndex >= 6 ||
  359.         ze_get_user_level(id) == 5 && iIndex >= 7 ||
  360.         ze_get_user_level(id) == 6 && iIndex >= 8 ||
  361.         ze_get_user_level(id) == 7 && iIndex >= 9 ||
  362.         ze_get_user_level(id) == 8 && iIndex >= 10 ||
  363.         ze_get_user_level(id) == 9 && iIndex >= 11 ||
  364.         ze_get_user_level(id) == 10 && iIndex >= 12 ||
  365.         ze_get_user_level(id) == 11 && iIndex >= 13 ||
  366.         ze_get_user_level(id) == 12 && iIndex >= 14)
  367.         {
  368.             break
  369.         }
  370.        
  371.         /*
  372.         *  Note that WPN_MAXIDS start from 1 but iIndex start from 0.
  373.         */
  374.        
  375.         // Golden M3
  376.         if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 20)
  377.         {
  378.             if (iIndex == 14)
  379.             {
  380.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Frost M4A1")
  381.                 break;
  382.             }
  383.         }
  384.        
  385.         // Golden MP5
  386.         if (ze_get_user_level(id) >= 20 && ze_get_user_level(id) < 25)
  387.         {
  388.             if (iIndex == 14)
  389.             {
  390.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Frost M4A1")
  391.             }
  392.            
  393.             if (iIndex == 15)
  394.             {
  395.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden MP5")
  396.                 break;
  397.             }
  398.         }
  399.        
  400.         // Golden M4A1
  401.         if (ze_get_user_level(id) >= 25 && ze_get_user_level(id) < 30)
  402.         {
  403.             if (iIndex == 14)
  404.             {
  405.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Frost M4A1")
  406.             }
  407.            
  408.             if (iIndex == 15)
  409.             {
  410.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden MP5")
  411.             }
  412.            
  413.             if (iIndex == 16)
  414.             {
  415.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden M4A1")
  416.                 break;
  417.             }
  418.         }
  419.        
  420.         // Golden AK47
  421.         if (ze_get_user_level(id) >= 30)
  422.         {
  423.             if (iIndex == 14)
  424.             {
  425.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Frost M4A1")
  426.             }
  427.            
  428.             if (iIndex == 15)
  429.             {
  430.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden MP5")
  431.             }
  432.            
  433.             if (iIndex == 16)
  434.             {
  435.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Golden M4A1")
  436.             }
  437.            
  438.             if (iIndex == 17)
  439.             {
  440.                 iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, "Thantos-5")
  441.                 break;
  442.             }
  443.         }
  444.        
  445.         // Must check if iIndex < 14 means max is AK47
  446.         if (iIndex < 14)
  447.         {
  448.             ArrayGetString(g_szPrimaryWeapons, iIndex, szWeaponName, charsmax(szWeaponName))
  449.             iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%d.\y %s^n", iIndex-WPN_STARTID+1, szWeaponNames[get_weaponid(szWeaponName)])
  450.         }
  451.     }
  452.    
  453.     if (iIndex < 7)
  454.     {
  455.         ArrayGetString(g_szPrimaryWeapons, iIndex, szWeaponName, charsmax(szWeaponName))
  456.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  457.     }
  458.    
  459.     if (ze_get_user_level(id) == 5)
  460.     {
  461.         ArrayGetString(g_szPrimaryWeapons, 7, szWeaponName, charsmax(szWeaponName))
  462.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  463.     }
  464.     else if (ze_get_user_level(id) == 6)
  465.     {
  466.         ArrayGetString(g_szPrimaryWeapons, 8, szWeaponName, charsmax(szWeaponName))
  467.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  468.     }
  469.     else if (ze_get_user_level(id) == 7)
  470.     {
  471.         ArrayGetString(g_szPrimaryWeapons, 9, szWeaponName, charsmax(szWeaponName))
  472.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  473.     }
  474.     else if (ze_get_user_level(id) == 8)
  475.     {
  476.         ArrayGetString(g_szPrimaryWeapons, 10, szWeaponName, charsmax(szWeaponName))
  477.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  478.     }
  479.     else if (ze_get_user_level(id) == 9)
  480.     {
  481.         ArrayGetString(g_szPrimaryWeapons, 11, szWeaponName, charsmax(szWeaponName))
  482.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  483.     }
  484.     else if (ze_get_user_level(id) == 10)
  485.     {
  486.         ArrayGetString(g_szPrimaryWeapons, 12, szWeaponName, charsmax(szWeaponName))
  487.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  488.     }
  489.     else if (ze_get_user_level(id) == 11)
  490.     {
  491.         ArrayGetString(g_szPrimaryWeapons, 13, szWeaponName, charsmax(szWeaponName))
  492.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Next Level Unlock\w: \y%s^n", szWeaponNames[get_weaponid(szWeaponName)])
  493.     }
  494.     else if (ze_get_user_level(id) >= 12 && ze_get_user_level(id) < 15) // Golden M3
  495.     {
  496.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Level 15 Unlock\w: \yFrost M4A1^n")
  497.     }
  498.     else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 20) // Golden MP5
  499.     {
  500.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Level 20 Unlock\w: \yGolden MP5^n")
  501.     }
  502.     else if (ze_get_user_level(id) >= 20 && ze_get_user_level(id) < 25) // Golden M4A1
  503.     {
  504.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Level 25 Unlock\w: \yGolden M4A1^n")
  505.     }
  506.     else if (ze_get_user_level(id) >= 25 && ze_get_user_level(id) < 30) // Thantos-5
  507.     {
  508.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r Level 30 Unlock\w: \yThantos-5^n")
  509.     }
  510.  
  511.     // 8. Auto Select
  512.     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")
  513.    
  514.     // 9. Next/Back - 0. Exit
  515.     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")
  516.    
  517.     // Fix for AMXX custom menus
  518.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  519.     show_menu(id, KEYSMENU, szMenu, iMenuTime, "Primary Weapons")
  520. }
  521.  
  522. public Show_Menu_Buy_Secondary(id)
  523. {
  524.     new iMenuTime = floatround(g_fBuyTimeStart[id] + get_pcvar_float(g_pCvarBuyTime) - get_gametime())
  525.    
  526.     if (iMenuTime <= 0)
  527.     {
  528.         ze_colored_print(id, "%L", id, "BUY_MENU_TIME_EXPIRED")
  529.         return
  530.     }
  531.    
  532.     static szMenu[250], szWeaponName[32]
  533.     new iLen, iIndex, iMaxLoops = ArraySize(g_szSecondaryWeapons)
  534.    
  535.     // Title
  536.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y%L^n", id, "MENU_SECONDARY_TITLE")
  537.    
  538.     // 1-6. Weapon List
  539.     for (iIndex = 0; iIndex < iMaxLoops; iIndex++)
  540.     {
  541.         if (ze_get_user_level(id) == 0 && iIndex >= 2 ||
  542.         ze_get_user_level(id) == 1 && iIndex >= 3 ||
  543.         ze_get_user_level(id) == 2 && iIndex >= 4 ||
  544.         ze_get_user_level(id) == 3 && iIndex >= 5 ||
  545.         ze_get_user_level(id) == 4 && iIndex >= 6)
  546.         {
  547.             break
  548.         }
  549.        
  550.         ArrayGetString(g_szSecondaryWeapons, iIndex, szWeaponName, charsmax(szWeaponName))
  551.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\w%d.\y %s", iIndex+1, szWeaponNames[get_weaponid(szWeaponName)])
  552.     }
  553.    
  554.     if (iIndex < ArraySize(g_szSecondaryWeapons))
  555.     {
  556.         ArrayGetString(g_szSecondaryWeapons, iIndex, szWeaponName, charsmax(szWeaponName))
  557.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\r Next Level Unlock\w: \y%s", szWeaponNames[get_weaponid(szWeaponName)])
  558.     }
  559.    
  560.     // 8. Auto Select
  561.     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")
  562.    
  563.     // 0. Exit
  564.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w0.\y %L", id, "EXIT")
  565.    
  566.     // Fix for AMXX custom menus
  567.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  568.     show_menu(id, KEYSMENU, szMenu, iMenuTime, "Secondary Weapons")
  569. }
  570.  
  571. public Menu_Buy_Primary(id, key)
  572. {
  573.     // Player dead or zombie or already bought primary
  574.     if (!is_user_alive(id) || ze_is_user_zombie(id) || g_bBoughtPrimary[id])
  575.         return PLUGIN_HANDLED
  576.    
  577.     // Special keys / weapon list exceeded
  578.     if (key >= MENU_KEY_AUTOSELECT || WPN_SELECTION >= WPN_MAXIDS[id])
  579.     {
  580.         switch (key)
  581.         {
  582.             case MENU_KEY_AUTOSELECT: // toggle auto select
  583.             {
  584.                 WPN_AUTO_ON = 1 - WPN_AUTO_ON
  585.             }
  586.             case MENU_KEY_NEXT: // next/back
  587.             {
  588.                 if (WPN_STARTID+7 < WPN_MAXIDS[id])
  589.                     WPN_STARTID += 7
  590.                 else
  591.                     WPN_STARTID = 0
  592.             }
  593.             case MENU_KEY_EXIT: // exit
  594.             {
  595.                 return PLUGIN_HANDLED
  596.             }
  597.         }
  598.        
  599.         // Show buy menu again
  600.         Show_Menu_Buy_Primary(id)
  601.         return PLUGIN_HANDLED
  602.     }
  603.    
  604.     // Store selected weapon id
  605.     WPN_AUTO_PRI = WPN_SELECTION
  606.    
  607.     // Buy primary weapon
  608.     Buy_Primary_Weapon(id, WPN_AUTO_PRI)
  609.    
  610.     // Show Secondary Weapons
  611.     Show_Available_Buy_Menus(id)
  612.    
  613.     return PLUGIN_HANDLED
  614. }
  615.  
  616. public Buy_Primary_Weapon(id, selection)
  617. {
  618.     if (selection == 14) // Frost M4A1
  619.     {
  620.         give_frost_m4a1(id)
  621.         g_bBoughtPrimary[id] = true
  622.         return true;
  623.     }
  624.     else if (selection == 15) // Golden MP5
  625.     {
  626.         give_golden_mp5(id)
  627.         g_bBoughtPrimary[id] = true
  628.         return true;
  629.     }
  630.     else if (selection == 16) // Golden M4A1
  631.     {
  632.         give_golden_m4a1(id)
  633.         g_bBoughtPrimary[id] = true
  634.         return true;
  635.     }
  636.     else if (selection == 17) // Thantos-5
  637.     {
  638.         give_thantos5(id)
  639.         g_bBoughtPrimary[id] = true
  640.         return true;
  641.     }
  642.    
  643.     static szWeaponName[32]
  644.     ArrayGetString(g_szPrimaryWeapons, selection, szWeaponName, charsmax(szWeaponName))
  645.     new iWeaponId = get_weaponid(szWeaponName)
  646.    
  647.     // Strip and Give Full Weapon
  648.     rg_give_item(id, szWeaponName, GT_REPLACE)
  649.     rg_set_user_bpammo(id, WeaponIdType:iWeaponId, szMaxBPAmmo[iWeaponId])
  650.    
  651.     // Primary bought
  652.     g_bBoughtPrimary[id] = true
  653.     return true;
  654. }
  655.  
  656. public Menu_Buy_Secondary(id, key)
  657. {
  658.     // Player dead or zombie or already bought secondary
  659.     if (!is_user_alive(id) || ze_is_user_zombie(id) || g_bBoughtSecondary[id])
  660.         return PLUGIN_HANDLED
  661.    
  662.     // Special keys / weapon list exceeded
  663.     if (key >= ArraySize(g_szSecondaryWeapons))
  664.     {
  665.         // Toggle autoselect
  666.         if (key == MENU_KEY_AUTOSELECT)
  667.             WPN_AUTO_ON = 1 - WPN_AUTO_ON
  668.        
  669.         // Reshow menu unless user exited
  670.         if (key != MENU_KEY_EXIT)
  671.             Show_Menu_Buy_Secondary(id)
  672.        
  673.         return PLUGIN_HANDLED
  674.     }
  675.    
  676.     // Store selected weapon id
  677.     WPN_AUTO_SEC = key
  678.    
  679.     // Buy secondary weapon
  680.     Buy_Secondary_Weapon(id, key)
  681.    
  682.     return PLUGIN_HANDLED
  683. }
  684.  
  685. public Buy_Secondary_Weapon(id, selection)
  686. {
  687.     if ( ((selection == 2) && (ze_get_user_level(id) < 1)) ||
  688.     ((selection == 3) && (ze_get_user_level(id) < 2)) ||
  689.     ((selection == 4) && (ze_get_user_level(id) < 3)) ||
  690.     ((selection == 5) && (ze_get_user_level(id) < 4)) )
  691.     {
  692.         Show_Menu_Buy_Secondary(id)
  693.         return;
  694.     }
  695.  
  696.     static szWeaponName[32]
  697.     ArrayGetString(g_szSecondaryWeapons, selection, szWeaponName, charsmax(szWeaponName))
  698.     new iWeaponId = get_weaponid(szWeaponName)
  699.    
  700.     // Strip and Give Full Weapon
  701.     rg_give_item(id, szWeaponName, GT_REPLACE)
  702.     rg_set_user_bpammo(id, WeaponIdType:iWeaponId, szMaxBPAmmo[iWeaponId])
  703.     ze_giveminigun(id)
  704.  
  705.    
  706.     // Secondary bought
  707.     g_bBoughtSecondary[id] = true
  708. }
  709.  
  710. public Fw_TouchWeapon_Pre(iEnt, id)
  711. {
  712.     if (get_pcvar_num(g_pCvarBlockWeapLowLevel) == 0)
  713.         return HAM_IGNORED;
  714.    
  715.     // Not alive or Not Valid Weapon?
  716.     if(!is_user_alive(id) || !pev_valid(iEnt))
  717.         return HAM_IGNORED;
  718.    
  719.     // Get Weapon Model
  720.     new szWeapModel[32]
  721.     pev(iEnt, pev_model, szWeapModel, charsmax(szWeapModel))
  722.    
  723.     // Remove "models/w_" and ".mdl"
  724.     copyc(szWeapModel, charsmax(szWeapModel), szWeapModel[contain(szWeapModel, "_" ) + 1], '.')
  725.    
  726.     // Set for mp5 to be same as "weapon_mp5navy"
  727.     if(szWeapModel[1] == 'p' && szWeapModel[2] == '5')
  728.         szWeapModel = "mp5navy"
  729.    
  730.     // Add "weapon_" to all model names
  731.     static szWeaponEnt[32]
  732.     formatex(szWeaponEnt, charsmax(szWeaponEnt), "weapon_%s", szWeapModel)
  733.  
  734.     // Get it's index in Weapon Array
  735.     new iIndex, i
  736.    
  737.     // I won't explain the blew code if you need to understand ask me in Escapers-Zone.XYZ
  738.     for (i = 0; i < ArraySize(g_szPrimaryWeapons); i++)
  739.     {
  740.         new szPrimaryWeapon[32]
  741.         ArrayGetString(g_szPrimaryWeapons, i, szPrimaryWeapon, charsmax(szPrimaryWeapon))
  742.        
  743.         if (equali(szWeaponEnt, szPrimaryWeapon))
  744.             iIndex = i
  745.     }
  746.    
  747.     if (ze_get_user_level(id) == 0 && iIndex > 1)
  748.     {
  749.         return HAM_SUPERCEDE;
  750.     }
  751.    
  752.     for (i = 1; i <= 11; i++)
  753.     {
  754.         if ((ze_get_user_level(id) == i) && iIndex > i+1)
  755.         {
  756.             return HAM_SUPERCEDE;
  757.         }
  758.     }
  759.    
  760.     return HAM_IGNORED;
  761. }
  762.  
  763. // Natives
  764. public native_ze_show_weapon_menu(id)
  765. {
  766.     if (!is_user_connected(id))
  767.     {
  768.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  769.         return false
  770.     }
  771.    
  772.     Cmd_Buy(id)
  773.     return true
  774. }
  775.  
  776. public native_ze_is_auto_buy_enabled(id)
  777. {
  778.     if (!is_user_connected(id))
  779.     {
  780.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  781.         return -1;
  782.     }
  783.    
  784.     return WPN_AUTO_ON;
  785. }
  786.  
  787. public native_ze_disable_auto_buy(id)
  788. {
  789.     if (!is_user_connected(id))
  790.     {
  791.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  792.         return false
  793.     }
  794.    
  795.     WPN_AUTO_ON = 0;
  796.     return true
  797. }
  798. [/code]

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 512
Joined: 1 Year Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 42 times
Age: 18
Contact:

#2

Post by Jack GamePlay » 1 Week Ago

What?!
Image

Luxurious
Member
Member
Egypt
Posts: 89
Joined: 10 Months Ago
Location: Egypt
Has thanked: 2 times
Been thanked: 1 time
Contact:

#3

Post by Luxurious » 1 Week Ago

Jack GamePlay wrote:
1 Week Ago
What?!
Make a Normal Weapons Like "M4a1 , Ak47 , Xm , ....." "Deagle , Glock , usp ...." make it from level 0 mean remove level from it
and Frost M4a1 From Level 15 ....

Luxurious
Member
Member
Egypt
Posts: 89
Joined: 10 Months Ago
Location: Egypt
Has thanked: 2 times
Been thanked: 1 time
Contact:

#4

Post by Luxurious » 1 Week Ago

up

User avatar
DarkZombie
Member
Member
Hungary
Posts: 68
Joined: 4 Months Ago
Donation: 1x donated in total €6.00
Has thanked: 16 times
Been thanked: 0
Contact:

#5

Post by DarkZombie » 1 Week Ago

I agree with Jack, it's not quite understandable what you want. Write down exactly, understandably and not so, for example, these and point-to-point points And its "up" like spam for hoping to get a quick answer? :D

Luxurious
Member
Member
Egypt
Posts: 89
Joined: 10 Months Ago
Location: Egypt
Has thanked: 2 times
Been thanked: 1 time
Contact:

#6

Post by Luxurious » 1 Week Ago

solved.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest