Weapon menu !

Coding Help/Re-API Supported
User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 258
Joined: 6 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 19 times
Age: 33
Contact:

Re: Weapon menu !

#11

Post by Mark » 5 Months Ago

Luxurious wrote:
5 Months Ago
Mark wrote:
5 Months Ago
Luxurious wrote:
5 Months Ago


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

Luxurious
Member
Member
Egypt
Posts: 96
Joined: 1 Year Ago
Location: Egypt
Has thanked: 2 times
Been thanked: 1 time
Contact:

#12

Post by Luxurious » 5 Months Ago

hmm.. Did u know what i want ?!
Attachments
Capture.JPG

User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 258
Joined: 6 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 19 times
Age: 33
Contact:

#13

Post by Mark » 5 Months Ago

Have no clue what you want lol

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1755
Joined: 2 Years Ago
Location: Egypt
Has thanked: 30 times
Been thanked: 87 times
Age: 21
Contact:

#14

Post by Raheem » 5 Months Ago

Please follow this: viewtopic.php?f=17&t=3437 if you like to add more custom weapons.

If you can't so post what you need and anyone can add it for you.
You don't know? Learn and you will know.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest