Plugin Available Vip extra Item Discounts

Unpaid Requests, Public Plugins
User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 258
Joined: 3 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: Vip extra Item Discounts

#51

Post by Mark » 2 Months Ago

Raheem wrote:
2 Months Ago
Hmm, post ur items manger source.
  1. #include <zombie_escape>
  2.  
  3. // Setting File
  4. new const ZE_EXTRAITEM_FILE[] = "ze_extraitems.ini"
  5.  
  6. // Defines
  7. #define MENU_PAGE_ITEMS g_iMenuData[id]
  8.  
  9. // Const
  10. const OFFSET_CSMENUCODE = 205
  11.  
  12. // Forwards
  13. enum _:TOTAL_FORWARDS
  14. {
  15.     FW_ITEM_SELECT_PRE = 0,
  16.     FW_ITEM_SELECT_POST
  17. }
  18.  
  19. new g_iForwards[TOTAL_FORWARDS],
  20.     g_iForwardReturn
  21.  
  22. // Variables
  23. new Array:g_szItemRealName,
  24.     Array:g_szItemName,  
  25.     Array:g_iItemCost,
  26.     Array:g_iItemLimit
  27.  
  28. new g_iItemCount,
  29.     g_szAdditionalMenuText[64],
  30.     g_iMenuData[33],
  31.     bool:g_bHasDiscount[MAX_EXTRA_ITEMS],
  32.     Float:g_flDiscountValue[MAX_EXTRA_ITEMS]
  33.  
  34. public plugin_init()
  35. {
  36.     register_plugin("[ZE] Items Manager", ZE_VERSION, AUTHORS)
  37.    
  38.     // Commands
  39.     register_clcmd("say /items", "Cmd_Items")
  40.    
  41.     // Forwards (In Pre Return Values important)
  42.     g_iForwards[FW_ITEM_SELECT_PRE] = CreateMultiForward("ze_select_item_pre", ET_CONTINUE, FP_CELL, FP_CELL, FP_CELL)
  43.     g_iForwards[FW_ITEM_SELECT_POST] = CreateMultiForward("ze_select_item_post", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL)
  44. }
  45.  
  46. public plugin_natives()
  47. {
  48.     register_native("ze_register_item", "native_ze_register_item")
  49.     register_native("ze_show_items_menu", "native_ze_show_items_menu")
  50.     register_native("ze_force_buy_item", "native_ze_force_buy_item")
  51.     register_native("ze_get_item_id", "native_ze_get_item_id")
  52.     register_native("ze_get_item_cost", "native_ze_get_item_cost")
  53.     register_native("ze_add_text_to_item", "native_ze_add_text_to_item")
  54.     register_native("ze_get_item_limit", "native_ze_get_item_limit")
  55.     register_native("ze_is_valid_itemid", "native_ze_is_valid_itemid")
  56.     register_native("ze_get_item_name", "native_ze_get_item_name")
  57.     register_native("ze_set_vip_discount", "native_ze_set_vip_discount", 1)
  58.     register_native("ze_has_vip_discount", "native_ze_has_vip_discount", 1)
  59.     register_native("ze_has_vip_discount", "native_ze_has_vip_discount", 1)
  60.     register_native("ze_get_item_discount", "native_ze_get_item_discount", 1)
  61.    
  62.     g_szItemRealName = ArrayCreate(32, 1)
  63.     g_szItemName = ArrayCreate(32, 1)
  64.     g_iItemCost = ArrayCreate(1, 1)
  65.     g_iItemLimit = ArrayCreate(1, 1)
  66. }
  67.  
  68. public client_disconnected(id)
  69. {
  70.     MENU_PAGE_ITEMS = 0
  71. }
  72.  
  73. public Cmd_Items(id)
  74. {
  75.     if (!is_user_alive(id))
  76.         return
  77.    
  78.     Show_Items_Menu(id)
  79. }
  80.  
  81. // Items Menu
  82. Show_Items_Menu(id)
  83. {
  84.     static menu[128], name[32], cost, transkey[64]
  85.     new menuid, index, itemdata[2]
  86.    
  87.     // Title
  88.     formatex(menu, charsmax(menu), "%L:\r", id, "BUY_EXTRAITEM")
  89.     menuid = menu_create(menu, "Extra_Items_Menu")
  90.    
  91.     // Item List
  92.     for (index = 0; index < g_iItemCount; index++)
  93.     {
  94.         // Additional text to display
  95.         g_szAdditionalMenuText[0] = 0
  96.        
  97.         // Execute item select attempt forward
  98.         ExecuteForward(g_iForwards[FW_ITEM_SELECT_PRE], g_iForwardReturn, id, index, 0)
  99.        
  100.         // Show item to player?
  101.         if (g_iForwardReturn >= ZE_ITEM_DONT_SHOW)
  102.             continue;
  103.        
  104.         // Add Item Name and Cost
  105.         ArrayGetString(g_szItemName, index, name, charsmax(name))
  106.         cost = ArrayGetCell(g_iItemCost, index)
  107.        
  108.         // ML support for item name
  109.         formatex(transkey, charsmax(transkey), "ITEMNAME %s", name)
  110.         if (GetLangTransKey(transkey) != TransKey_Bad) formatex(name, charsmax(name), "%L", id, transkey)
  111.        
  112.         // Item available to player?
  113.         if (g_iForwardReturn >= ZE_ITEM_UNAVAILABLE)
  114.             formatex(menu, charsmax(menu), "\d%s %d %s", name, cost, g_szAdditionalMenuText)
  115.         else
  116.             formatex(menu, charsmax(menu), "%s \y%d \w%s", name, cost, g_szAdditionalMenuText)
  117.        
  118.         itemdata[0] = index
  119.         itemdata[1] = 0
  120.         menu_additem(menuid, menu, itemdata)
  121.     }
  122.    
  123.     // No items to display?
  124.     if (menu_items(menuid) <= 0)
  125.     {
  126.         ze_colored_print(id, "%L", id, "NO_EXTRA_ITEMS")
  127.         menu_destroy(menuid)
  128.         return;
  129.     }
  130.    
  131.     // Back - Next - Exit
  132.     formatex(menu, charsmax(menu), "%L", id, "BACK")
  133.     menu_setprop(menuid, MPROP_BACKNAME, menu)
  134.     formatex(menu, charsmax(menu), "%L", id, "NEXT")
  135.     menu_setprop(menuid, MPROP_NEXTNAME, menu)
  136.     formatex(menu, charsmax(menu), "%L", id, "EXIT")
  137.     menu_setprop(menuid, MPROP_EXITNAME, menu)
  138.    
  139.     // If remembered page is greater than number of pages, clamp down the value
  140.     MENU_PAGE_ITEMS = min(MENU_PAGE_ITEMS, menu_pages(menuid)-1)
  141.    
  142.     // Fix for AMXX custom menus
  143.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  144.     menu_display(id, menuid, MENU_PAGE_ITEMS)
  145. }
  146.  
  147. // Items Menu
  148. public Extra_Items_Menu(id, menuid, item)
  149. {
  150.     // Menu was closed
  151.     if (item == MENU_EXIT)
  152.     {
  153.         MENU_PAGE_ITEMS = 0
  154.         menu_destroy(menuid)
  155.         return PLUGIN_HANDLED;
  156.     }
  157.    
  158.     // Remember items menu page
  159.     MENU_PAGE_ITEMS = item / 7
  160.    
  161.     // Dead players are not allowed to buy items
  162.     if (!is_user_alive(id))
  163.     {
  164.         menu_destroy(menuid)
  165.         return PLUGIN_HANDLED;
  166.     }
  167.    
  168.     // Retrieve item id
  169.     new itemdata[2], dummy, itemid
  170.     menu_item_getinfo(menuid, item, dummy, itemdata, charsmax(itemdata), _, _, dummy)
  171.     itemid = itemdata[0]
  172.    
  173.     // Attempt to buy the item
  174.     Buy_Item(id, itemid)
  175.     menu_destroy(menuid)
  176.     return PLUGIN_HANDLED;
  177. }
  178.  
  179. // Buy Item
  180. Buy_Item(id, itemid, ignorecost = 0)
  181. {
  182.     // Execute item select attempt forward
  183.     ExecuteForward(g_iForwards[FW_ITEM_SELECT_PRE], g_iForwardReturn, id, itemid, ignorecost)
  184.    
  185.     // Item available to player?
  186.     if (g_iForwardReturn >= ZE_ITEM_UNAVAILABLE)
  187.         return;
  188.    
  189.     // Execute item selected forward
  190.     ExecuteForward(g_iForwards[FW_ITEM_SELECT_POST], g_iForwardReturn, id, itemid, ignorecost)
  191. }
  192.  
  193. // Natives
  194. public native_ze_register_item(plugin_id, num_params)
  195. {
  196.     new szItem_Name[32], iItem_Cost, iItem_Limit
  197.    
  198.     // Get the Data from first Parameter in the native (Item Name)
  199.     get_string(1, szItem_Name, charsmax(szItem_Name))
  200.    
  201.     // Get the Second Parameter (Item Cost)
  202.     iItem_Cost = get_param(2)
  203.    
  204.     // Get limit third parameter
  205.     iItem_Limit = get_param(3)
  206.    
  207.     if (strlen(szItem_Name) < 1)
  208.     {
  209.         // Can't leave item name empty
  210.         log_error(AMX_ERR_NATIVE, "[ZE] Can't register item with an empty name")
  211.         return ZE_WRONG_ITEM // Same as return -1
  212.     }
  213.    
  214.     new iIndex, szItemName[32]
  215.    
  216.     // Loop from 0 to max items amount
  217.     for (iIndex = 0; iIndex < g_iItemCount; iIndex++)
  218.     {
  219.         ArrayGetString(g_szItemRealName, iIndex, szItemName, charsmax(szItemName))
  220.        
  221.         if (equali(szItem_Name, szItemName))
  222.         {
  223.             log_error(AMX_ERR_NATIVE, "[ZE] Item already registered (%s)", szItemName)
  224.             return ZE_WRONG_ITEM; // Return -1
  225.         }
  226.     }
  227.    
  228.     // Load settings from extra items file
  229.     new szItemRealName[32]
  230.     copy(szItemRealName, charsmax(szItemRealName), szItem_Name)
  231.     ArrayPushString(g_szItemRealName, szItemRealName)
  232.    
  233.     // Name
  234.     if (!amx_load_setting_string(ZE_EXTRAITEM_FILE, szItemRealName, "NAME", szItem_Name, charsmax(szItem_Name)))
  235.         amx_save_setting_string(ZE_EXTRAITEM_FILE, szItemRealName, "NAME", szItem_Name)
  236.     ArrayPushString(g_szItemName, szItem_Name)
  237.    
  238.     // Cost
  239.     if (!amx_load_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "COST", iItem_Cost))
  240.         amx_save_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "COST", iItem_Cost)
  241.     ArrayPushCell(g_iItemCost, iItem_Cost)
  242.    
  243.     // Limit
  244.     if (!amx_load_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "LIMIT", iItem_Limit))
  245.         amx_save_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "LIMIT", iItem_Limit)
  246.     ArrayPushCell(g_iItemLimit, iItem_Limit)
  247.    
  248.     g_iItemCount++
  249.     return g_iItemCount - 1
  250. }
  251.  
  252. public native_ze_show_items_menu(plugin_id, num_params)
  253. {
  254.     new id = get_param(1)
  255.    
  256.     if (!is_user_connected(id))
  257.     {
  258.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  259.         return false;
  260.     }
  261.    
  262.     Cmd_Items(id)
  263.     return true
  264. }
  265.  
  266. public native_ze_force_buy_item(plugin_id, num_params)
  267. {
  268.     new id = get_param(1)
  269.    
  270.     if (!is_user_connected(id))
  271.     {
  272.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  273.         return false;
  274.     }
  275.    
  276.     new item_id = get_param(2)
  277.    
  278.     if (item_id < 0 || item_id >= g_iItemCount)
  279.     {
  280.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  281.         return false;
  282.     }
  283.    
  284.     new ignorecost = get_param(3)
  285.    
  286.     Buy_Item(id, item_id, ignorecost)
  287.     return true;
  288. }
  289.  
  290. public native_ze_get_item_id(plugin_id, num_params)
  291. {
  292.     new szRealName[32]
  293.     get_string(1, szRealName, charsmax(szRealName))
  294.  
  295.     new index, szItemName[32]
  296.    
  297.     for (index = 0; index < g_iItemCount; index++)
  298.     {
  299.         ArrayGetString(g_szItemRealName, index, szItemName, charsmax(szItemName))
  300.        
  301.         if (equali(szRealName, szItemName))
  302.             return index
  303.     }
  304.    
  305.     return ZE_WRONG_ITEM
  306. }
  307.  
  308. public native_ze_get_item_cost(plugin_id, num_params)
  309. {
  310.     new item_id = get_param(1)
  311.    
  312.     if (item_id < 0 || item_id >= g_iItemCount)
  313.     {
  314.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  315.         return ZE_WRONG_ITEM;
  316.     }
  317.    
  318.     return ArrayGetCell(g_iItemCost, item_id);
  319. }
  320.  
  321. public native_ze_add_text_to_item(plugin_id, num_params)
  322. {
  323.     new szText[32]
  324.     get_string(1, szText, charsmax(szText))
  325.     format(g_szAdditionalMenuText, charsmax(g_szAdditionalMenuText), "%s%s", g_szAdditionalMenuText, szText)
  326. }
  327.  
  328. public native_ze_get_item_limit(plugin_id, num_params)
  329. {
  330.     new item_id = get_param(1)
  331.    
  332.     if (item_id < 0 || item_id >= g_iItemCount)
  333.     {
  334.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  335.         return ZE_WRONG_ITEM;
  336.     }
  337.    
  338.     return ArrayGetCell(g_iItemLimit, item_id);
  339. }
  340.  
  341. public native_ze_is_valid_itemid(plugin_id, num_params)
  342. {
  343.     new item_id = get_param(1)
  344.    
  345.     if (item_id < 0 || item_id >= g_iItemCount)
  346.     {
  347.         return false;
  348.     }
  349.    
  350.     return true;
  351. }
  352.  
  353. public native_ze_get_item_name(plugin_id, num_params)
  354. {
  355.     new item_id = get_param(1)
  356.    
  357.     if (item_id < 0 || item_id >= g_iItemCount)
  358.     {
  359.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  360.         return ZE_WRONG_ITEM;
  361.     }
  362.    
  363.     new szName[32]
  364.     ArrayGetString(g_szItemName, item_id, szName, charsmax(szName))
  365.    
  366.     new iLen = get_param(3)
  367.     set_string(2, szName, iLen)
  368.     return true;
  369. }
  370.  
  371. public native_ze_set_vip_discount(iItemid, bool:bSet, Float:flDiscount)
  372. {
  373.     g_bHasDiscount[iItemid] = bSet;
  374.     g_flDiscountValue[iItemid] = flDiscount;
  375. }
  376.  
  377. public native_ze_has_vip_discount(iItemid)
  378. {
  379.     return g_bHasDiscount[iItemid]
  380. }
  381.  
  382. public Float:native_ze_get_item_discount(iItemid)
  383. {
  384.     return g_flDiscountValue[iItemid]
  385. }

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1717
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#52

Post by Raheem » 2 Months Ago

Seems that the itemid exceeded the max items, we will need some logs will post u debug to do but wait when i go pc 50 minute.

[ Post made via Nexus 7 ]
You don't know? Learn and you will know.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1717
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#53

Post by Raheem » 2 Months Ago

With this try reproduce the error, and try detect it happens in which item. After it's appear again go to logs folder and check Items.log:

  1. #include <zombie_escape>
  2.  
  3. // Setting File
  4. new const ZE_EXTRAITEM_FILE[] = "ze_extraitems.ini"
  5.  
  6. // Defines
  7. #define MENU_PAGE_ITEMS g_iMenuData[id]
  8.  
  9. // Const
  10. const OFFSET_CSMENUCODE = 205
  11.  
  12. // Forwards
  13. enum _:TOTAL_FORWARDS
  14. {
  15.     FW_ITEM_SELECT_PRE = 0,
  16.     FW_ITEM_SELECT_POST
  17. }
  18.  
  19. new g_iForwards[TOTAL_FORWARDS],
  20.     g_iForwardReturn
  21.  
  22. // Variables
  23. new Array:g_szItemRealName,
  24.     Array:g_szItemName,  
  25.     Array:g_iItemCost,
  26.     Array:g_iItemLimit
  27.  
  28. new g_iItemCount,
  29.     g_szAdditionalMenuText[64],
  30.     g_iMenuData[33],
  31.     bool:g_bHasDiscount[MAX_EXTRA_ITEMS],
  32.     Float:g_flDiscountValue[MAX_EXTRA_ITEMS]
  33.  
  34. public plugin_init()
  35. {
  36.     register_plugin("[ZE] Items Manager", ZE_VERSION, AUTHORS)
  37.    
  38.     // Commands
  39.     register_clcmd("say /items", "Cmd_Items")
  40.    
  41.     // Forwards (In Pre Return Values important)
  42.     g_iForwards[FW_ITEM_SELECT_PRE] = CreateMultiForward("ze_select_item_pre", ET_CONTINUE, FP_CELL, FP_CELL, FP_CELL)
  43.     g_iForwards[FW_ITEM_SELECT_POST] = CreateMultiForward("ze_select_item_post", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL)
  44. }
  45.  
  46. public plugin_natives()
  47. {
  48.     register_native("ze_register_item", "native_ze_register_item")
  49.     register_native("ze_show_items_menu", "native_ze_show_items_menu")
  50.     register_native("ze_force_buy_item", "native_ze_force_buy_item")
  51.     register_native("ze_get_item_id", "native_ze_get_item_id")
  52.     register_native("ze_get_item_cost", "native_ze_get_item_cost")
  53.     register_native("ze_add_text_to_item", "native_ze_add_text_to_item")
  54.     register_native("ze_get_item_limit", "native_ze_get_item_limit")
  55.     register_native("ze_is_valid_itemid", "native_ze_is_valid_itemid")
  56.     register_native("ze_get_item_name", "native_ze_get_item_name")
  57.     register_native("ze_set_vip_discount", "native_ze_set_vip_discount", 1)
  58.     register_native("ze_has_vip_discount", "native_ze_has_vip_discount", 1)
  59.     register_native("ze_has_vip_discount", "native_ze_has_vip_discount", 1)
  60.     register_native("ze_get_item_discount", "native_ze_get_item_discount", 1)
  61.    
  62.     g_szItemRealName = ArrayCreate(32, 1)
  63.     g_szItemName = ArrayCreate(32, 1)
  64.     g_iItemCost = ArrayCreate(1, 1)
  65.     g_iItemLimit = ArrayCreate(1, 1)
  66. }
  67.  
  68. public client_disconnected(id)
  69. {
  70.     MENU_PAGE_ITEMS = 0
  71. }
  72.  
  73. public Cmd_Items(id)
  74. {
  75.     if (!is_user_alive(id))
  76.         return
  77.    
  78.     Show_Items_Menu(id)
  79. }
  80.  
  81. // Items Menu
  82. Show_Items_Menu(id)
  83. {
  84.     static menu[128], name[32], cost, transkey[64]
  85.     new menuid, index, itemdata[2]
  86.    
  87.     // Title
  88.     formatex(menu, charsmax(menu), "%L:\r", id, "BUY_EXTRAITEM")
  89.     menuid = menu_create(menu, "Extra_Items_Menu")
  90.    
  91.     // Item List
  92.     for (index = 0; index < g_iItemCount; index++)
  93.     {
  94.         // Additional text to display
  95.         g_szAdditionalMenuText[0] = 0
  96.        
  97.         // Execute item select attempt forward
  98.         ExecuteForward(g_iForwards[FW_ITEM_SELECT_PRE], g_iForwardReturn, id, index, 0)
  99.        
  100.         // Show item to player?
  101.         if (g_iForwardReturn >= ZE_ITEM_DONT_SHOW)
  102.             continue;
  103.        
  104.         // Add Item Name and Cost
  105.         ArrayGetString(g_szItemName, index, name, charsmax(name))
  106.         cost = ArrayGetCell(g_iItemCost, index)
  107.        
  108.         // ML support for item name
  109.         formatex(transkey, charsmax(transkey), "ITEMNAME %s", name)
  110.         if (GetLangTransKey(transkey) != TransKey_Bad) formatex(name, charsmax(name), "%L", id, transkey)
  111.        
  112.         // Item available to player?
  113.         if (g_iForwardReturn >= ZE_ITEM_UNAVAILABLE)
  114.             formatex(menu, charsmax(menu), "\d%s %d %s", name, cost, g_szAdditionalMenuText)
  115.         else
  116.             formatex(menu, charsmax(menu), "%s \y%d \w%s", name, cost, g_szAdditionalMenuText)
  117.        
  118.         itemdata[0] = index
  119.         itemdata[1] = 0
  120.         menu_additem(menuid, menu, itemdata)
  121.     }
  122.    
  123.     // No items to display?
  124.     if (menu_items(menuid) <= 0)
  125.     {
  126.         ze_colored_print(id, "%L", id, "NO_EXTRA_ITEMS")
  127.         menu_destroy(menuid)
  128.         return;
  129.     }
  130.    
  131.     // Back - Next - Exit
  132.     formatex(menu, charsmax(menu), "%L", id, "BACK")
  133.     menu_setprop(menuid, MPROP_BACKNAME, menu)
  134.     formatex(menu, charsmax(menu), "%L", id, "NEXT")
  135.     menu_setprop(menuid, MPROP_NEXTNAME, menu)
  136.     formatex(menu, charsmax(menu), "%L", id, "EXIT")
  137.     menu_setprop(menuid, MPROP_EXITNAME, menu)
  138.    
  139.     // If remembered page is greater than number of pages, clamp down the value
  140.     MENU_PAGE_ITEMS = min(MENU_PAGE_ITEMS, menu_pages(menuid)-1)
  141.    
  142.     // Fix for AMXX custom menus
  143.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  144.     menu_display(id, menuid, MENU_PAGE_ITEMS)
  145. }
  146.  
  147. // Items Menu
  148. public Extra_Items_Menu(id, menuid, item)
  149. {
  150.     // Menu was closed
  151.     if (item == MENU_EXIT)
  152.     {
  153.         MENU_PAGE_ITEMS = 0
  154.         menu_destroy(menuid)
  155.         return PLUGIN_HANDLED;
  156.     }
  157.    
  158.     // Remember items menu page
  159.     MENU_PAGE_ITEMS = item / 7
  160.    
  161.     // Dead players are not allowed to buy items
  162.     if (!is_user_alive(id))
  163.     {
  164.         menu_destroy(menuid)
  165.         return PLUGIN_HANDLED;
  166.     }
  167.    
  168.     // Retrieve item id
  169.     new itemdata[2], dummy, itemid
  170.     menu_item_getinfo(menuid, item, dummy, itemdata, charsmax(itemdata), _, _, dummy)
  171.     itemid = itemdata[0]
  172.    
  173.     // Attempt to buy the item
  174.     Buy_Item(id, itemid)
  175.     menu_destroy(menuid)
  176.     return PLUGIN_HANDLED;
  177. }
  178.  
  179. // Buy Item
  180. Buy_Item(id, itemid, ignorecost = 0)
  181. {
  182.     // Execute item select attempt forward
  183.     ExecuteForward(g_iForwards[FW_ITEM_SELECT_PRE], g_iForwardReturn, id, itemid, ignorecost)
  184.    
  185.     // Item available to player?
  186.     if (g_iForwardReturn >= ZE_ITEM_UNAVAILABLE)
  187.         return;
  188.    
  189.     // Execute item selected forward
  190.     ExecuteForward(g_iForwards[FW_ITEM_SELECT_POST], g_iForwardReturn, id, itemid, ignorecost)
  191. }
  192.  
  193. // Natives
  194. public native_ze_register_item(plugin_id, num_params)
  195. {
  196.     new szItem_Name[32], iItem_Cost, iItem_Limit
  197.    
  198.     // Get the Data from first Parameter in the native (Item Name)
  199.     get_string(1, szItem_Name, charsmax(szItem_Name))
  200.    
  201.     // Get the Second Parameter (Item Cost)
  202.     iItem_Cost = get_param(2)
  203.    
  204.     // Get limit third parameter
  205.     iItem_Limit = get_param(3)
  206.    
  207.     if (strlen(szItem_Name) < 1)
  208.     {
  209.         // Can't leave item name empty
  210.         log_error(AMX_ERR_NATIVE, "[ZE] Can't register item with an empty name")
  211.         return ZE_WRONG_ITEM // Same as return -1
  212.     }
  213.    
  214.     new iIndex, szItemName[32]
  215.    
  216.     // Loop from 0 to max items amount
  217.     for (iIndex = 0; iIndex < g_iItemCount; iIndex++)
  218.     {
  219.         ArrayGetString(g_szItemRealName, iIndex, szItemName, charsmax(szItemName))
  220.        
  221.         if (equali(szItem_Name, szItemName))
  222.         {
  223.             log_error(AMX_ERR_NATIVE, "[ZE] Item already registered (%s)", szItemName)
  224.             return ZE_WRONG_ITEM; // Return -1
  225.         }
  226.     }
  227.    
  228.     // Load settings from extra items file
  229.     new szItemRealName[32]
  230.     copy(szItemRealName, charsmax(szItemRealName), szItem_Name)
  231.     ArrayPushString(g_szItemRealName, szItemRealName)
  232.    
  233.     // Name
  234.     if (!amx_load_setting_string(ZE_EXTRAITEM_FILE, szItemRealName, "NAME", szItem_Name, charsmax(szItem_Name)))
  235.         amx_save_setting_string(ZE_EXTRAITEM_FILE, szItemRealName, "NAME", szItem_Name)
  236.     ArrayPushString(g_szItemName, szItem_Name)
  237.    
  238.     // Cost
  239.     if (!amx_load_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "COST", iItem_Cost))
  240.         amx_save_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "COST", iItem_Cost)
  241.     ArrayPushCell(g_iItemCost, iItem_Cost)
  242.    
  243.     // Limit
  244.     if (!amx_load_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "LIMIT", iItem_Limit))
  245.         amx_save_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "LIMIT", iItem_Limit)
  246.     ArrayPushCell(g_iItemLimit, iItem_Limit)
  247.    
  248.     g_iItemCount++
  249.     return g_iItemCount - 1
  250. }
  251.  
  252. public native_ze_show_items_menu(plugin_id, num_params)
  253. {
  254.     new id = get_param(1)
  255.    
  256.     if (!is_user_connected(id))
  257.     {
  258.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  259.         return false;
  260.     }
  261.    
  262.     Cmd_Items(id)
  263.     return true
  264. }
  265.  
  266. public native_ze_force_buy_item(plugin_id, num_params)
  267. {
  268.     new id = get_param(1)
  269.    
  270.     if (!is_user_connected(id))
  271.     {
  272.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  273.         return false;
  274.     }
  275.    
  276.     new item_id = get_param(2)
  277.    
  278.     if (item_id < 0 || item_id >= g_iItemCount)
  279.     {
  280.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  281.         return false;
  282.     }
  283.    
  284.     new ignorecost = get_param(3)
  285.    
  286.     Buy_Item(id, item_id, ignorecost)
  287.     return true;
  288. }
  289.  
  290. public native_ze_get_item_id(plugin_id, num_params)
  291. {
  292.     new szRealName[32]
  293.     get_string(1, szRealName, charsmax(szRealName))
  294.  
  295.     new index, szItemName[32]
  296.    
  297.     for (index = 0; index < g_iItemCount; index++)
  298.     {
  299.         ArrayGetString(g_szItemRealName, index, szItemName, charsmax(szItemName))
  300.        
  301.         if (equali(szRealName, szItemName))
  302.             return index
  303.     }
  304.    
  305.     return ZE_WRONG_ITEM
  306. }
  307.  
  308. public native_ze_get_item_cost(plugin_id, num_params)
  309. {
  310.     new item_id = get_param(1)
  311.    
  312.     if (item_id < 0 || item_id >= g_iItemCount)
  313.     {
  314.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  315.         return ZE_WRONG_ITEM;
  316.     }
  317.    
  318.     return ArrayGetCell(g_iItemCost, item_id);
  319. }
  320.  
  321. public native_ze_add_text_to_item(plugin_id, num_params)
  322. {
  323.     new szText[32]
  324.     get_string(1, szText, charsmax(szText))
  325.     format(g_szAdditionalMenuText, charsmax(g_szAdditionalMenuText), "%s%s", g_szAdditionalMenuText, szText)
  326. }
  327.  
  328. public native_ze_get_item_limit(plugin_id, num_params)
  329. {
  330.     new item_id = get_param(1)
  331.    
  332.     if (item_id < 0 || item_id >= g_iItemCount)
  333.     {
  334.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  335.         return ZE_WRONG_ITEM;
  336.     }
  337.    
  338.     return ArrayGetCell(g_iItemLimit, item_id);
  339. }
  340.  
  341. public native_ze_is_valid_itemid(plugin_id, num_params)
  342. {
  343.     new item_id = get_param(1)
  344.    
  345.     if (item_id < 0 || item_id >= g_iItemCount)
  346.     {
  347.         return false;
  348.     }
  349.    
  350.     return true;
  351. }
  352.  
  353. public native_ze_get_item_name(plugin_id, num_params)
  354. {
  355.     new item_id = get_param(1)
  356.    
  357.     if (item_id < 0 || item_id >= g_iItemCount)
  358.     {
  359.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  360.         return ZE_WRONG_ITEM;
  361.     }
  362.    
  363.     new szName[32]
  364.     ArrayGetString(g_szItemName, item_id, szName, charsmax(szName))
  365.    
  366.     new iLen = get_param(3)
  367.     set_string(2, szName, iLen)
  368.     return true;
  369. }
  370.  
  371. public native_ze_set_vip_discount(iItemid, bool:bSet, Float:flDiscount)
  372. {
  373.     g_bHasDiscount[iItemid] = bSet;
  374.     g_flDiscountValue[iItemid] = flDiscount;
  375. }
  376.  
  377. public native_ze_has_vip_discount(iItemid)
  378. {
  379.     log_to_file("Items.log", "Itemid: %i - MaxItems: %i", iItemid, MAX_EXTRA_ITEMS)
  380.     return g_bHasDiscount[iItemid]
  381. }
  382.  
  383. public Float:native_ze_get_item_discount(iItemid)
  384. {
  385.     return g_flDiscountValue[iItemid]
  386. }
You don't know? Learn and you will know.

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

#54

Post by Mark » 2 Months Ago

Raheem wrote:
2 Months Ago
With this try reproduce the error, and try detect it happens in which item. After it's appear again go to logs folder and check Items.log:

  1. #include <zombie_escape>
  2.  
  3. // Setting File
  4. new const ZE_EXTRAITEM_FILE[] = "ze_extraitems.ini"
  5.  
  6. // Defines
  7. #define MENU_PAGE_ITEMS g_iMenuData[id]
  8.  
  9. // Const
  10. const OFFSET_CSMENUCODE = 205
  11.  
  12. // Forwards
  13. enum _:TOTAL_FORWARDS
  14. {
  15.     FW_ITEM_SELECT_PRE = 0,
  16.     FW_ITEM_SELECT_POST
  17. }
  18.  
  19. new g_iForwards[TOTAL_FORWARDS],
  20.     g_iForwardReturn
  21.  
  22. // Variables
  23. new Array:g_szItemRealName,
  24.     Array:g_szItemName,  
  25.     Array:g_iItemCost,
  26.     Array:g_iItemLimit
  27.  
  28. new g_iItemCount,
  29.     g_szAdditionalMenuText[64],
  30.     g_iMenuData[33],
  31.     bool:g_bHasDiscount[MAX_EXTRA_ITEMS],
  32.     Float:g_flDiscountValue[MAX_EXTRA_ITEMS]
  33.  
  34. public plugin_init()
  35. {
  36.     register_plugin("[ZE] Items Manager", ZE_VERSION, AUTHORS)
  37.    
  38.     // Commands
  39.     register_clcmd("say /items", "Cmd_Items")
  40.    
  41.     // Forwards (In Pre Return Values important)
  42.     g_iForwards[FW_ITEM_SELECT_PRE] = CreateMultiForward("ze_select_item_pre", ET_CONTINUE, FP_CELL, FP_CELL, FP_CELL)
  43.     g_iForwards[FW_ITEM_SELECT_POST] = CreateMultiForward("ze_select_item_post", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL)
  44. }
  45.  
  46. public plugin_natives()
  47. {
  48.     register_native("ze_register_item", "native_ze_register_item")
  49.     register_native("ze_show_items_menu", "native_ze_show_items_menu")
  50.     register_native("ze_force_buy_item", "native_ze_force_buy_item")
  51.     register_native("ze_get_item_id", "native_ze_get_item_id")
  52.     register_native("ze_get_item_cost", "native_ze_get_item_cost")
  53.     register_native("ze_add_text_to_item", "native_ze_add_text_to_item")
  54.     register_native("ze_get_item_limit", "native_ze_get_item_limit")
  55.     register_native("ze_is_valid_itemid", "native_ze_is_valid_itemid")
  56.     register_native("ze_get_item_name", "native_ze_get_item_name")
  57.     register_native("ze_set_vip_discount", "native_ze_set_vip_discount", 1)
  58.     register_native("ze_has_vip_discount", "native_ze_has_vip_discount", 1)
  59.     register_native("ze_has_vip_discount", "native_ze_has_vip_discount", 1)
  60.     register_native("ze_get_item_discount", "native_ze_get_item_discount", 1)
  61.    
  62.     g_szItemRealName = ArrayCreate(32, 1)
  63.     g_szItemName = ArrayCreate(32, 1)
  64.     g_iItemCost = ArrayCreate(1, 1)
  65.     g_iItemLimit = ArrayCreate(1, 1)
  66. }
  67.  
  68. public client_disconnected(id)
  69. {
  70.     MENU_PAGE_ITEMS = 0
  71. }
  72.  
  73. public Cmd_Items(id)
  74. {
  75.     if (!is_user_alive(id))
  76.         return
  77.    
  78.     Show_Items_Menu(id)
  79. }
  80.  
  81. // Items Menu
  82. Show_Items_Menu(id)
  83. {
  84.     static menu[128], name[32], cost, transkey[64]
  85.     new menuid, index, itemdata[2]
  86.    
  87.     // Title
  88.     formatex(menu, charsmax(menu), "%L:\r", id, "BUY_EXTRAITEM")
  89.     menuid = menu_create(menu, "Extra_Items_Menu")
  90.    
  91.     // Item List
  92.     for (index = 0; index < g_iItemCount; index++)
  93.     {
  94.         // Additional text to display
  95.         g_szAdditionalMenuText[0] = 0
  96.        
  97.         // Execute item select attempt forward
  98.         ExecuteForward(g_iForwards[FW_ITEM_SELECT_PRE], g_iForwardReturn, id, index, 0)
  99.        
  100.         // Show item to player?
  101.         if (g_iForwardReturn >= ZE_ITEM_DONT_SHOW)
  102.             continue;
  103.        
  104.         // Add Item Name and Cost
  105.         ArrayGetString(g_szItemName, index, name, charsmax(name))
  106.         cost = ArrayGetCell(g_iItemCost, index)
  107.        
  108.         // ML support for item name
  109.         formatex(transkey, charsmax(transkey), "ITEMNAME %s", name)
  110.         if (GetLangTransKey(transkey) != TransKey_Bad) formatex(name, charsmax(name), "%L", id, transkey)
  111.        
  112.         // Item available to player?
  113.         if (g_iForwardReturn >= ZE_ITEM_UNAVAILABLE)
  114.             formatex(menu, charsmax(menu), "\d%s %d %s", name, cost, g_szAdditionalMenuText)
  115.         else
  116.             formatex(menu, charsmax(menu), "%s \y%d \w%s", name, cost, g_szAdditionalMenuText)
  117.        
  118.         itemdata[0] = index
  119.         itemdata[1] = 0
  120.         menu_additem(menuid, menu, itemdata)
  121.     }
  122.    
  123.     // No items to display?
  124.     if (menu_items(menuid) <= 0)
  125.     {
  126.         ze_colored_print(id, "%L", id, "NO_EXTRA_ITEMS")
  127.         menu_destroy(menuid)
  128.         return;
  129.     }
  130.    
  131.     // Back - Next - Exit
  132.     formatex(menu, charsmax(menu), "%L", id, "BACK")
  133.     menu_setprop(menuid, MPROP_BACKNAME, menu)
  134.     formatex(menu, charsmax(menu), "%L", id, "NEXT")
  135.     menu_setprop(menuid, MPROP_NEXTNAME, menu)
  136.     formatex(menu, charsmax(menu), "%L", id, "EXIT")
  137.     menu_setprop(menuid, MPROP_EXITNAME, menu)
  138.    
  139.     // If remembered page is greater than number of pages, clamp down the value
  140.     MENU_PAGE_ITEMS = min(MENU_PAGE_ITEMS, menu_pages(menuid)-1)
  141.    
  142.     // Fix for AMXX custom menus
  143.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  144.     menu_display(id, menuid, MENU_PAGE_ITEMS)
  145. }
  146.  
  147. // Items Menu
  148. public Extra_Items_Menu(id, menuid, item)
  149. {
  150.     // Menu was closed
  151.     if (item == MENU_EXIT)
  152.     {
  153.         MENU_PAGE_ITEMS = 0
  154.         menu_destroy(menuid)
  155.         return PLUGIN_HANDLED;
  156.     }
  157.    
  158.     // Remember items menu page
  159.     MENU_PAGE_ITEMS = item / 7
  160.    
  161.     // Dead players are not allowed to buy items
  162.     if (!is_user_alive(id))
  163.     {
  164.         menu_destroy(menuid)
  165.         return PLUGIN_HANDLED;
  166.     }
  167.    
  168.     // Retrieve item id
  169.     new itemdata[2], dummy, itemid
  170.     menu_item_getinfo(menuid, item, dummy, itemdata, charsmax(itemdata), _, _, dummy)
  171.     itemid = itemdata[0]
  172.    
  173.     // Attempt to buy the item
  174.     Buy_Item(id, itemid)
  175.     menu_destroy(menuid)
  176.     return PLUGIN_HANDLED;
  177. }
  178.  
  179. // Buy Item
  180. Buy_Item(id, itemid, ignorecost = 0)
  181. {
  182.     // Execute item select attempt forward
  183.     ExecuteForward(g_iForwards[FW_ITEM_SELECT_PRE], g_iForwardReturn, id, itemid, ignorecost)
  184.    
  185.     // Item available to player?
  186.     if (g_iForwardReturn >= ZE_ITEM_UNAVAILABLE)
  187.         return;
  188.    
  189.     // Execute item selected forward
  190.     ExecuteForward(g_iForwards[FW_ITEM_SELECT_POST], g_iForwardReturn, id, itemid, ignorecost)
  191. }
  192.  
  193. // Natives
  194. public native_ze_register_item(plugin_id, num_params)
  195. {
  196.     new szItem_Name[32], iItem_Cost, iItem_Limit
  197.    
  198.     // Get the Data from first Parameter in the native (Item Name)
  199.     get_string(1, szItem_Name, charsmax(szItem_Name))
  200.    
  201.     // Get the Second Parameter (Item Cost)
  202.     iItem_Cost = get_param(2)
  203.    
  204.     // Get limit third parameter
  205.     iItem_Limit = get_param(3)
  206.    
  207.     if (strlen(szItem_Name) < 1)
  208.     {
  209.         // Can't leave item name empty
  210.         log_error(AMX_ERR_NATIVE, "[ZE] Can't register item with an empty name")
  211.         return ZE_WRONG_ITEM // Same as return -1
  212.     }
  213.    
  214.     new iIndex, szItemName[32]
  215.    
  216.     // Loop from 0 to max items amount
  217.     for (iIndex = 0; iIndex < g_iItemCount; iIndex++)
  218.     {
  219.         ArrayGetString(g_szItemRealName, iIndex, szItemName, charsmax(szItemName))
  220.        
  221.         if (equali(szItem_Name, szItemName))
  222.         {
  223.             log_error(AMX_ERR_NATIVE, "[ZE] Item already registered (%s)", szItemName)
  224.             return ZE_WRONG_ITEM; // Return -1
  225.         }
  226.     }
  227.    
  228.     // Load settings from extra items file
  229.     new szItemRealName[32]
  230.     copy(szItemRealName, charsmax(szItemRealName), szItem_Name)
  231.     ArrayPushString(g_szItemRealName, szItemRealName)
  232.    
  233.     // Name
  234.     if (!amx_load_setting_string(ZE_EXTRAITEM_FILE, szItemRealName, "NAME", szItem_Name, charsmax(szItem_Name)))
  235.         amx_save_setting_string(ZE_EXTRAITEM_FILE, szItemRealName, "NAME", szItem_Name)
  236.     ArrayPushString(g_szItemName, szItem_Name)
  237.    
  238.     // Cost
  239.     if (!amx_load_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "COST", iItem_Cost))
  240.         amx_save_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "COST", iItem_Cost)
  241.     ArrayPushCell(g_iItemCost, iItem_Cost)
  242.    
  243.     // Limit
  244.     if (!amx_load_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "LIMIT", iItem_Limit))
  245.         amx_save_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "LIMIT", iItem_Limit)
  246.     ArrayPushCell(g_iItemLimit, iItem_Limit)
  247.    
  248.     g_iItemCount++
  249.     return g_iItemCount - 1
  250. }
  251.  
  252. public native_ze_show_items_menu(plugin_id, num_params)
  253. {
  254.     new id = get_param(1)
  255.    
  256.     if (!is_user_connected(id))
  257.     {
  258.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  259.         return false;
  260.     }
  261.    
  262.     Cmd_Items(id)
  263.     return true
  264. }
  265.  
  266. public native_ze_force_buy_item(plugin_id, num_params)
  267. {
  268.     new id = get_param(1)
  269.    
  270.     if (!is_user_connected(id))
  271.     {
  272.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  273.         return false;
  274.     }
  275.    
  276.     new item_id = get_param(2)
  277.    
  278.     if (item_id < 0 || item_id >= g_iItemCount)
  279.     {
  280.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  281.         return false;
  282.     }
  283.    
  284.     new ignorecost = get_param(3)
  285.    
  286.     Buy_Item(id, item_id, ignorecost)
  287.     return true;
  288. }
  289.  
  290. public native_ze_get_item_id(plugin_id, num_params)
  291. {
  292.     new szRealName[32]
  293.     get_string(1, szRealName, charsmax(szRealName))
  294.  
  295.     new index, szItemName[32]
  296.    
  297.     for (index = 0; index < g_iItemCount; index++)
  298.     {
  299.         ArrayGetString(g_szItemRealName, index, szItemName, charsmax(szItemName))
  300.        
  301.         if (equali(szRealName, szItemName))
  302.             return index
  303.     }
  304.    
  305.     return ZE_WRONG_ITEM
  306. }
  307.  
  308. public native_ze_get_item_cost(plugin_id, num_params)
  309. {
  310.     new item_id = get_param(1)
  311.    
  312.     if (item_id < 0 || item_id >= g_iItemCount)
  313.     {
  314.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  315.         return ZE_WRONG_ITEM;
  316.     }
  317.    
  318.     return ArrayGetCell(g_iItemCost, item_id);
  319. }
  320.  
  321. public native_ze_add_text_to_item(plugin_id, num_params)
  322. {
  323.     new szText[32]
  324.     get_string(1, szText, charsmax(szText))
  325.     format(g_szAdditionalMenuText, charsmax(g_szAdditionalMenuText), "%s%s", g_szAdditionalMenuText, szText)
  326. }
  327.  
  328. public native_ze_get_item_limit(plugin_id, num_params)
  329. {
  330.     new item_id = get_param(1)
  331.    
  332.     if (item_id < 0 || item_id >= g_iItemCount)
  333.     {
  334.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  335.         return ZE_WRONG_ITEM;
  336.     }
  337.    
  338.     return ArrayGetCell(g_iItemLimit, item_id);
  339. }
  340.  
  341. public native_ze_is_valid_itemid(plugin_id, num_params)
  342. {
  343.     new item_id = get_param(1)
  344.    
  345.     if (item_id < 0 || item_id >= g_iItemCount)
  346.     {
  347.         return false;
  348.     }
  349.    
  350.     return true;
  351. }
  352.  
  353. public native_ze_get_item_name(plugin_id, num_params)
  354. {
  355.     new item_id = get_param(1)
  356.    
  357.     if (item_id < 0 || item_id >= g_iItemCount)
  358.     {
  359.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  360.         return ZE_WRONG_ITEM;
  361.     }
  362.    
  363.     new szName[32]
  364.     ArrayGetString(g_szItemName, item_id, szName, charsmax(szName))
  365.    
  366.     new iLen = get_param(3)
  367.     set_string(2, szName, iLen)
  368.     return true;
  369. }
  370.  
  371. public native_ze_set_vip_discount(iItemid, bool:bSet, Float:flDiscount)
  372. {
  373.     g_bHasDiscount[iItemid] = bSet;
  374.     g_flDiscountValue[iItemid] = flDiscount;
  375. }
  376.  
  377. public native_ze_has_vip_discount(iItemid)
  378. {
  379.     log_to_file("Items.log", "Itemid: %i - MaxItems: %i", iItemid, MAX_EXTRA_ITEMS)
  380.     return g_bHasDiscount[iItemid]
  381. }
  382.  
  383. public Float:native_ze_get_item_discount(iItemid)
  384. {
  385.     return g_flDiscountValue[iItemid]
  386. }
  1. L 09/25/2018 - 22:15:01: Itemid: 0 - MaxItems: 40
  2. L 09/25/2018 - 22:15:01: Itemid: 0 - MaxItems: 40
  3. L 09/25/2018 - 22:15:01: Itemid: 0 - MaxItems: 40
  4. L 09/25/2018 - 22:15:01: Itemid: 1 - MaxItems: 40
  5. L 09/25/2018 - 22:15:01: Itemid: 1 - MaxItems: 40
  6. L 09/25/2018 - 22:15:01: Itemid: 1 - MaxItems: 40
  7. L 09/25/2018 - 22:15:01: Itemid: 2 - MaxItems: 40
  8. L 09/25/2018 - 22:15:01: Itemid: 3 - MaxItems: 40
  9. L 09/25/2018 - 22:15:01: Itemid: 4 - MaxItems: 40
  10. L 09/25/2018 - 22:15:01: Itemid: 5 - MaxItems: 40
  11. L 09/25/2018 - 22:15:01: Itemid: 6 - MaxItems: 40
  12. L 09/25/2018 - 22:15:01: Itemid: 7 - MaxItems: 40
  13. L 09/25/2018 - 22:15:01: Itemid: 8 - MaxItems: 40
  14. L 09/25/2018 - 22:15:01: Itemid: 9 - MaxItems: 40
  15. L 09/25/2018 - 22:15:01: Itemid: 9 - MaxItems: 40
  16. L 09/25/2018 - 22:15:01: Itemid: 9 - MaxItems: 40
  17. L 09/25/2018 - 22:15:01: Itemid: 10 - MaxItems: 40
  18. L 09/25/2018 - 22:15:01: Itemid: 10 - MaxItems: 40
  19. L 09/25/2018 - 22:15:01: Itemid: 10 - MaxItems: 40
  20. L 09/25/2018 - 22:15:01: Itemid: 11 - MaxItems: 40
  21. L 09/25/2018 - 22:15:01: Itemid: 12 - MaxItems: 40
  22. L 09/25/2018 - 22:15:01: Itemid: 13 - MaxItems: 40
  23. L 09/25/2018 - 22:15:01: Itemid: 14 - MaxItems: 40
  24. L 09/25/2018 - 22:15:01: Itemid: 14 - MaxItems: 40
  25. L 09/25/2018 - 22:15:01: Itemid: 14 - MaxItems: 40
  26. L 09/25/2018 - 22:15:01: Itemid: 15 - MaxItems: 40
  27. L 09/25/2018 - 22:15:01: Itemid: 15 - MaxItems: 40
  28. L 09/25/2018 - 22:15:01: Itemid: 15 - MaxItems: 40
  29. L 09/25/2018 - 22:15:01: Itemid: 16 - MaxItems: 40
  30. L 09/25/2018 - 22:15:01: Itemid: 17 - MaxItems: 40
  31. L 09/25/2018 - 22:15:01: Itemid: 18 - MaxItems: 40
  32. L 09/25/2018 - 22:15:01: Itemid: 18 - MaxItems: 40
  33. L 09/25/2018 - 22:15:01: Itemid: 18 - MaxItems: 40
  34. L 09/25/2018 - 22:15:01: Itemid: 19 - MaxItems: 40
  35. L 09/25/2018 - 22:15:01: Itemid: 19 - MaxItems: 40
  36. L 09/25/2018 - 22:15:01: Itemid: 19 - MaxItems: 40
  37. L 09/25/2018 - 22:15:01: Itemid: 20 - MaxItems: 40
  38. L 09/25/2018 - 22:15:01: Itemid: 20 - MaxItems: 40
  39. L 09/25/2018 - 22:15:01: Itemid: 20 - MaxItems: 40
  40. L 09/25/2018 - 22:15:01: Itemid: 21 - MaxItems: 40
  41. L 09/25/2018 - 22:15:01: Itemid: 21 - MaxItems: 40
  42. L 09/25/2018 - 22:15:01: Itemid: 21 - MaxItems: 40
  43. L 09/25/2018 - 22:15:01: Itemid: 22 - MaxItems: 40
  44. L 09/25/2018 - 22:15:01: Itemid: 22 - MaxItems: 40
  45. L 09/25/2018 - 22:15:01: Itemid: 22 - MaxItems: 40
  46. L 09/25/2018 - 22:15:01: Itemid: 23 - MaxItems: 40
  47. L 09/25/2018 - 22:15:01: Itemid: 23 - MaxItems: 40
  48. L 09/25/2018 - 22:15:01: Itemid: 23 - MaxItems: 40
  49. L 09/25/2018 - 22:15:01: Itemid: 24 - MaxItems: 40
  50. L 09/25/2018 - 22:15:01: Itemid: 24 - MaxItems: 40
  51. L 09/25/2018 - 22:15:01: Itemid: 24 - MaxItems: 40
  52. L 09/25/2018 - 22:15:01: Itemid: 25 - MaxItems: 40
  53. L 09/25/2018 - 22:15:01: Itemid: 25 - MaxItems: 40
  54. L 09/25/2018 - 22:15:01: Itemid: 25 - MaxItems: 40
  55. L 09/25/2018 - 22:15:01: Itemid: 26 - MaxItems: 40
  56. L 09/25/2018 - 22:15:01: Itemid: 26 - MaxItems: 40
  57. L 09/25/2018 - 22:15:01: Itemid: 26 - MaxItems: 40
  58. L 09/25/2018 - 22:15:01: Itemid: 27 - MaxItems: 40
  59. L 09/25/2018 - 22:15:01: Itemid: 27 - MaxItems: 40
  60. L 09/25/2018 - 22:15:01: Itemid: 27 - MaxItems: 40
  61. L 09/25/2018 - 22:15:01: Itemid: 28 - MaxItems: 40
  62. L 09/25/2018 - 22:15:01: Itemid: 28 - MaxItems: 40
  63. L 09/25/2018 - 22:15:01: Itemid: 28 - MaxItems: 40
  64. L 09/25/2018 - 22:15:01: Itemid: 29 - MaxItems: 40
  65. L 09/25/2018 - 22:15:01: Itemid: 29 - MaxItems: 40
  66. L 09/25/2018 - 22:15:01: Itemid: 29 - MaxItems: 40
  67. L 09/25/2018 - 22:15:01: Itemid: 30 - MaxItems: 40
  68. L 09/25/2018 - 22:15:01: Itemid: 30 - MaxItems: 40
  69. L 09/25/2018 - 22:15:01: Itemid: 30 - MaxItems: 40
  70. L 09/25/2018 - 22:15:01: Itemid: 31 - MaxItems: 40
  71. L 09/25/2018 - 22:15:01: Itemid: 31 - MaxItems: 40
  72. L 09/25/2018 - 22:15:01: Itemid: 31 - MaxItems: 40
  73. L 09/25/2018 - 22:15:01: Itemid: 32 - MaxItems: 40
  74. L 09/25/2018 - 22:15:01: Itemid: 32 - MaxItems: 40
  75. L 09/25/2018 - 22:15:01: Itemid: 32 - MaxItems: 40
  76. L 09/25/2018 - 22:15:01: Itemid: 33 - MaxItems: 40
  77. L 09/25/2018 - 22:15:01: Itemid: 33 - MaxItems: 40
  78. L 09/25/2018 - 22:15:01: Itemid: 33 - MaxItems: 40
  79. L 09/25/2018 - 22:15:01: Itemid: 34 - MaxItems: 40
  80. L 09/25/2018 - 22:15:01: Itemid: 34 - MaxItems: 40
  81. L 09/25/2018 - 22:15:01: Itemid: 34 - MaxItems: 40
  82. L 09/25/2018 - 22:15:01: Itemid: 35 - MaxItems: 40
  83. L 09/25/2018 - 22:15:01: Itemid: 35 - MaxItems: 40
  84. L 09/25/2018 - 22:15:01: Itemid: 35 - MaxItems: 40
  85. L 09/25/2018 - 22:15:01: Itemid: 36 - MaxItems: 40
  86. L 09/25/2018 - 22:15:01: Itemid: 36 - MaxItems: 40
  87. L 09/25/2018 - 22:15:01: Itemid: 36 - MaxItems: 40
  88. L 09/25/2018 - 22:15:01: Itemid: 37 - MaxItems: 40
  89. L 09/25/2018 - 22:15:01: Itemid: 37 - MaxItems: 40
  90. L 09/25/2018 - 22:15:01: Itemid: 37 - MaxItems: 40
  91. L 09/25/2018 - 22:15:01: Itemid: 38 - MaxItems: 40
  92. L 09/25/2018 - 22:15:01: Itemid: 38 - MaxItems: 40
  93. L 09/25/2018 - 22:15:01: Itemid: 38 - MaxItems: 40
  94. L 09/25/2018 - 22:15:01: Itemid: 39 - MaxItems: 40
  95. L 09/25/2018 - 22:15:01: Itemid: 39 - MaxItems: 40
  96. L 09/25/2018 - 22:15:01: Itemid: 39 - MaxItems: 40
  97. L 09/25/2018 - 22:15:01: Itemid: 40 - MaxItems: 40
  98. L 09/25/2018 - 22:15:04: Itemid: 1 - MaxItems: 40
  99. L 09/25/2018 - 22:15:04: Itemid: 1 - MaxItems: 40
  100. L 09/25/2018 - 22:15:04: Itemid: 1 - MaxItems: 40
  101. L 09/25/2018 - 22:15:04: Itemid: 1 - MaxItems: 40
  102. L 09/25/2018 - 22:15:04: Itemid: 1 - MaxItems: 40
  103. L 09/25/2018 - 22:15:04: Itemid: 1 - MaxItems: 40

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

#55

Post by Mark » 2 Months Ago

Raheem wrote:
2 Months Ago
With this try reproduce the error, and try detect it happens in which item. After it's appear again go to logs folder and check Items.log:

  1. #include <zombie_escape>
  2.  
  3. // Setting File
  4. new const ZE_EXTRAITEM_FILE[] = "ze_extraitems.ini"
  5.  
  6. // Defines
  7. #define MENU_PAGE_ITEMS g_iMenuData[id]
  8.  
  9. // Const
  10. const OFFSET_CSMENUCODE = 205
  11.  
  12. // Forwards
  13. enum _:TOTAL_FORWARDS
  14. {
  15.     FW_ITEM_SELECT_PRE = 0,
  16.     FW_ITEM_SELECT_POST
  17. }
  18.  
  19. new g_iForwards[TOTAL_FORWARDS],
  20.     g_iForwardReturn
  21.  
  22. // Variables
  23. new Array:g_szItemRealName,
  24.     Array:g_szItemName,  
  25.     Array:g_iItemCost,
  26.     Array:g_iItemLimit
  27.  
  28. new g_iItemCount,
  29.     g_szAdditionalMenuText[64],
  30.     g_iMenuData[33],
  31.     bool:g_bHasDiscount[MAX_EXTRA_ITEMS],
  32.     Float:g_flDiscountValue[MAX_EXTRA_ITEMS]
  33.  
  34. public plugin_init()
  35. {
  36.     register_plugin("[ZE] Items Manager", ZE_VERSION, AUTHORS)
  37.    
  38.     // Commands
  39.     register_clcmd("say /items", "Cmd_Items")
  40.    
  41.     // Forwards (In Pre Return Values important)
  42.     g_iForwards[FW_ITEM_SELECT_PRE] = CreateMultiForward("ze_select_item_pre", ET_CONTINUE, FP_CELL, FP_CELL, FP_CELL)
  43.     g_iForwards[FW_ITEM_SELECT_POST] = CreateMultiForward("ze_select_item_post", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL)
  44. }
  45.  
  46. public plugin_natives()
  47. {
  48.     register_native("ze_register_item", "native_ze_register_item")
  49.     register_native("ze_show_items_menu", "native_ze_show_items_menu")
  50.     register_native("ze_force_buy_item", "native_ze_force_buy_item")
  51.     register_native("ze_get_item_id", "native_ze_get_item_id")
  52.     register_native("ze_get_item_cost", "native_ze_get_item_cost")
  53.     register_native("ze_add_text_to_item", "native_ze_add_text_to_item")
  54.     register_native("ze_get_item_limit", "native_ze_get_item_limit")
  55.     register_native("ze_is_valid_itemid", "native_ze_is_valid_itemid")
  56.     register_native("ze_get_item_name", "native_ze_get_item_name")
  57.     register_native("ze_set_vip_discount", "native_ze_set_vip_discount", 1)
  58.     register_native("ze_has_vip_discount", "native_ze_has_vip_discount", 1)
  59.     register_native("ze_has_vip_discount", "native_ze_has_vip_discount", 1)
  60.     register_native("ze_get_item_discount", "native_ze_get_item_discount", 1)
  61.    
  62.     g_szItemRealName = ArrayCreate(32, 1)
  63.     g_szItemName = ArrayCreate(32, 1)
  64.     g_iItemCost = ArrayCreate(1, 1)
  65.     g_iItemLimit = ArrayCreate(1, 1)
  66. }
  67.  
  68. public client_disconnected(id)
  69. {
  70.     MENU_PAGE_ITEMS = 0
  71. }
  72.  
  73. public Cmd_Items(id)
  74. {
  75.     if (!is_user_alive(id))
  76.         return
  77.    
  78.     Show_Items_Menu(id)
  79. }
  80.  
  81. // Items Menu
  82. Show_Items_Menu(id)
  83. {
  84.     static menu[128], name[32], cost, transkey[64]
  85.     new menuid, index, itemdata[2]
  86.    
  87.     // Title
  88.     formatex(menu, charsmax(menu), "%L:\r", id, "BUY_EXTRAITEM")
  89.     menuid = menu_create(menu, "Extra_Items_Menu")
  90.    
  91.     // Item List
  92.     for (index = 0; index < g_iItemCount; index++)
  93.     {
  94.         // Additional text to display
  95.         g_szAdditionalMenuText[0] = 0
  96.        
  97.         // Execute item select attempt forward
  98.         ExecuteForward(g_iForwards[FW_ITEM_SELECT_PRE], g_iForwardReturn, id, index, 0)
  99.        
  100.         // Show item to player?
  101.         if (g_iForwardReturn >= ZE_ITEM_DONT_SHOW)
  102.             continue;
  103.        
  104.         // Add Item Name and Cost
  105.         ArrayGetString(g_szItemName, index, name, charsmax(name))
  106.         cost = ArrayGetCell(g_iItemCost, index)
  107.        
  108.         // ML support for item name
  109.         formatex(transkey, charsmax(transkey), "ITEMNAME %s", name)
  110.         if (GetLangTransKey(transkey) != TransKey_Bad) formatex(name, charsmax(name), "%L", id, transkey)
  111.        
  112.         // Item available to player?
  113.         if (g_iForwardReturn >= ZE_ITEM_UNAVAILABLE)
  114.             formatex(menu, charsmax(menu), "\d%s %d %s", name, cost, g_szAdditionalMenuText)
  115.         else
  116.             formatex(menu, charsmax(menu), "%s \y%d \w%s", name, cost, g_szAdditionalMenuText)
  117.        
  118.         itemdata[0] = index
  119.         itemdata[1] = 0
  120.         menu_additem(menuid, menu, itemdata)
  121.     }
  122.    
  123.     // No items to display?
  124.     if (menu_items(menuid) <= 0)
  125.     {
  126.         ze_colored_print(id, "%L", id, "NO_EXTRA_ITEMS")
  127.         menu_destroy(menuid)
  128.         return;
  129.     }
  130.    
  131.     // Back - Next - Exit
  132.     formatex(menu, charsmax(menu), "%L", id, "BACK")
  133.     menu_setprop(menuid, MPROP_BACKNAME, menu)
  134.     formatex(menu, charsmax(menu), "%L", id, "NEXT")
  135.     menu_setprop(menuid, MPROP_NEXTNAME, menu)
  136.     formatex(menu, charsmax(menu), "%L", id, "EXIT")
  137.     menu_setprop(menuid, MPROP_EXITNAME, menu)
  138.    
  139.     // If remembered page is greater than number of pages, clamp down the value
  140.     MENU_PAGE_ITEMS = min(MENU_PAGE_ITEMS, menu_pages(menuid)-1)
  141.    
  142.     // Fix for AMXX custom menus
  143.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  144.     menu_display(id, menuid, MENU_PAGE_ITEMS)
  145. }
  146.  
  147. // Items Menu
  148. public Extra_Items_Menu(id, menuid, item)
  149. {
  150.     // Menu was closed
  151.     if (item == MENU_EXIT)
  152.     {
  153.         MENU_PAGE_ITEMS = 0
  154.         menu_destroy(menuid)
  155.         return PLUGIN_HANDLED;
  156.     }
  157.    
  158.     // Remember items menu page
  159.     MENU_PAGE_ITEMS = item / 7
  160.    
  161.     // Dead players are not allowed to buy items
  162.     if (!is_user_alive(id))
  163.     {
  164.         menu_destroy(menuid)
  165.         return PLUGIN_HANDLED;
  166.     }
  167.    
  168.     // Retrieve item id
  169.     new itemdata[2], dummy, itemid
  170.     menu_item_getinfo(menuid, item, dummy, itemdata, charsmax(itemdata), _, _, dummy)
  171.     itemid = itemdata[0]
  172.    
  173.     // Attempt to buy the item
  174.     Buy_Item(id, itemid)
  175.     menu_destroy(menuid)
  176.     return PLUGIN_HANDLED;
  177. }
  178.  
  179. // Buy Item
  180. Buy_Item(id, itemid, ignorecost = 0)
  181. {
  182.     // Execute item select attempt forward
  183.     ExecuteForward(g_iForwards[FW_ITEM_SELECT_PRE], g_iForwardReturn, id, itemid, ignorecost)
  184.    
  185.     // Item available to player?
  186.     if (g_iForwardReturn >= ZE_ITEM_UNAVAILABLE)
  187.         return;
  188.    
  189.     // Execute item selected forward
  190.     ExecuteForward(g_iForwards[FW_ITEM_SELECT_POST], g_iForwardReturn, id, itemid, ignorecost)
  191. }
  192.  
  193. // Natives
  194. public native_ze_register_item(plugin_id, num_params)
  195. {
  196.     new szItem_Name[32], iItem_Cost, iItem_Limit
  197.    
  198.     // Get the Data from first Parameter in the native (Item Name)
  199.     get_string(1, szItem_Name, charsmax(szItem_Name))
  200.    
  201.     // Get the Second Parameter (Item Cost)
  202.     iItem_Cost = get_param(2)
  203.    
  204.     // Get limit third parameter
  205.     iItem_Limit = get_param(3)
  206.    
  207.     if (strlen(szItem_Name) < 1)
  208.     {
  209.         // Can't leave item name empty
  210.         log_error(AMX_ERR_NATIVE, "[ZE] Can't register item with an empty name")
  211.         return ZE_WRONG_ITEM // Same as return -1
  212.     }
  213.    
  214.     new iIndex, szItemName[32]
  215.    
  216.     // Loop from 0 to max items amount
  217.     for (iIndex = 0; iIndex < g_iItemCount; iIndex++)
  218.     {
  219.         ArrayGetString(g_szItemRealName, iIndex, szItemName, charsmax(szItemName))
  220.        
  221.         if (equali(szItem_Name, szItemName))
  222.         {
  223.             log_error(AMX_ERR_NATIVE, "[ZE] Item already registered (%s)", szItemName)
  224.             return ZE_WRONG_ITEM; // Return -1
  225.         }
  226.     }
  227.    
  228.     // Load settings from extra items file
  229.     new szItemRealName[32]
  230.     copy(szItemRealName, charsmax(szItemRealName), szItem_Name)
  231.     ArrayPushString(g_szItemRealName, szItemRealName)
  232.    
  233.     // Name
  234.     if (!amx_load_setting_string(ZE_EXTRAITEM_FILE, szItemRealName, "NAME", szItem_Name, charsmax(szItem_Name)))
  235.         amx_save_setting_string(ZE_EXTRAITEM_FILE, szItemRealName, "NAME", szItem_Name)
  236.     ArrayPushString(g_szItemName, szItem_Name)
  237.    
  238.     // Cost
  239.     if (!amx_load_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "COST", iItem_Cost))
  240.         amx_save_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "COST", iItem_Cost)
  241.     ArrayPushCell(g_iItemCost, iItem_Cost)
  242.    
  243.     // Limit
  244.     if (!amx_load_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "LIMIT", iItem_Limit))
  245.         amx_save_setting_int(ZE_EXTRAITEM_FILE, szItemRealName, "LIMIT", iItem_Limit)
  246.     ArrayPushCell(g_iItemLimit, iItem_Limit)
  247.    
  248.     g_iItemCount++
  249.     return g_iItemCount - 1
  250. }
  251.  
  252. public native_ze_show_items_menu(plugin_id, num_params)
  253. {
  254.     new id = get_param(1)
  255.    
  256.     if (!is_user_connected(id))
  257.     {
  258.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  259.         return false;
  260.     }
  261.    
  262.     Cmd_Items(id)
  263.     return true
  264. }
  265.  
  266. public native_ze_force_buy_item(plugin_id, num_params)
  267. {
  268.     new id = get_param(1)
  269.    
  270.     if (!is_user_connected(id))
  271.     {
  272.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  273.         return false;
  274.     }
  275.    
  276.     new item_id = get_param(2)
  277.    
  278.     if (item_id < 0 || item_id >= g_iItemCount)
  279.     {
  280.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  281.         return false;
  282.     }
  283.    
  284.     new ignorecost = get_param(3)
  285.    
  286.     Buy_Item(id, item_id, ignorecost)
  287.     return true;
  288. }
  289.  
  290. public native_ze_get_item_id(plugin_id, num_params)
  291. {
  292.     new szRealName[32]
  293.     get_string(1, szRealName, charsmax(szRealName))
  294.  
  295.     new index, szItemName[32]
  296.    
  297.     for (index = 0; index < g_iItemCount; index++)
  298.     {
  299.         ArrayGetString(g_szItemRealName, index, szItemName, charsmax(szItemName))
  300.        
  301.         if (equali(szRealName, szItemName))
  302.             return index
  303.     }
  304.    
  305.     return ZE_WRONG_ITEM
  306. }
  307.  
  308. public native_ze_get_item_cost(plugin_id, num_params)
  309. {
  310.     new item_id = get_param(1)
  311.    
  312.     if (item_id < 0 || item_id >= g_iItemCount)
  313.     {
  314.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  315.         return ZE_WRONG_ITEM;
  316.     }
  317.    
  318.     return ArrayGetCell(g_iItemCost, item_id);
  319. }
  320.  
  321. public native_ze_add_text_to_item(plugin_id, num_params)
  322. {
  323.     new szText[32]
  324.     get_string(1, szText, charsmax(szText))
  325.     format(g_szAdditionalMenuText, charsmax(g_szAdditionalMenuText), "%s%s", g_szAdditionalMenuText, szText)
  326. }
  327.  
  328. public native_ze_get_item_limit(plugin_id, num_params)
  329. {
  330.     new item_id = get_param(1)
  331.    
  332.     if (item_id < 0 || item_id >= g_iItemCount)
  333.     {
  334.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  335.         return ZE_WRONG_ITEM;
  336.     }
  337.    
  338.     return ArrayGetCell(g_iItemLimit, item_id);
  339. }
  340.  
  341. public native_ze_is_valid_itemid(plugin_id, num_params)
  342. {
  343.     new item_id = get_param(1)
  344.    
  345.     if (item_id < 0 || item_id >= g_iItemCount)
  346.     {
  347.         return false;
  348.     }
  349.    
  350.     return true;
  351. }
  352.  
  353. public native_ze_get_item_name(plugin_id, num_params)
  354. {
  355.     new item_id = get_param(1)
  356.    
  357.     if (item_id < 0 || item_id >= g_iItemCount)
  358.     {
  359.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid item id (%d)", item_id)
  360.         return ZE_WRONG_ITEM;
  361.     }
  362.    
  363.     new szName[32]
  364.     ArrayGetString(g_szItemName, item_id, szName, charsmax(szName))
  365.    
  366.     new iLen = get_param(3)
  367.     set_string(2, szName, iLen)
  368.     return true;
  369. }
  370.  
  371. public native_ze_set_vip_discount(iItemid, bool:bSet, Float:flDiscount)
  372. {
  373.     g_bHasDiscount[iItemid] = bSet;
  374.     g_flDiscountValue[iItemid] = flDiscount;
  375. }
  376.  
  377. public native_ze_has_vip_discount(iItemid)
  378. {
  379.     log_to_file("Items.log", "Itemid: %i - MaxItems: %i", iItemid, MAX_EXTRA_ITEMS)
  380.     return g_bHasDiscount[iItemid]
  381. }
  382.  
  383. public Float:native_ze_get_item_discount(iItemid)
  384. {
  385.     return g_flDiscountValue[iItemid]
  386. }
This prob the problem? AHAHHAHA
  1. [Stealth \w[ \r16 sec.\w]]
  2. NAME = Stealth \w[ \r16 sec.\w]
  3.  
  4. [Stealth \w[ \r16 sec.\w]]
  5. COST = 60
  6.  
  7. [Stealth \w[ \r16 sec.\w]]
  8. LIMIT = 1
  9.  
  10. [Stealth \w[ \r16 sec.\w]]
  11. NAME = Stealth \w[ \r16 sec.\w]
  12.  
  13. [Stealth \w[ \r16 sec.\w]]
  14. COST = 60
  15.  
  16. [Stealth \w[ \r16 sec.\w]]
  17. LIMIT = 1
  18.  
  19. [Stealth \w[ \r16 sec.\w]]
  20. NAME = Stealth \w[ \r16 sec.\w]
  21.  
  22. [Stealth \w[ \r16 sec.\w]]
  23. COST = 60
  24.  
  25. [Stealth \w[ \r16 sec.\w]]
  26. LIMIT = 1
  27.  
  28. [Stealth \w[ \r16 sec.\w]]
  29. NAME = Stealth \w[ \r16 sec.\w]
  30.  
  31. [Stealth \w[ \r16 sec.\w]]
  32. COST = 60
  33.  
  34. [Stealth \w[ \r16 sec.\w]]
  35. LIMIT = 1
  36.  
  37. [Stealth \w[ \r16 sec.\w]]
  38. NAME = Stealth \w[ \r16 sec.\w]
  39.  
  40. [Stealth \w[ \r16 sec.\w]]
  41. COST = 60
  42.  
  43. [Stealth \w[ \r16 sec.\w]]
  44. LIMIT = 1
  45.  
  46. [Stealth \w[ \r16 sec.\w]]
  47. NAME = Stealth \w[ \r16 sec.\w]
  48.  
  49. [Stealth \w[ \r16 sec.\w]]
  50. COST = 60
  51.  
  52. [Stealth \w[ \r16 sec.\w]]
  53. LIMIT = 1
  54.  
  55. [Stealth \w[ \r16 sec.\w]]
  56. NAME = Stealth \w[ \r16 sec.\w]
  57.  
  58. [Stealth \w[ \r16 sec.\w]]
  59. COST = 60
  60.  
  61. [Stealth \w[ \r16 sec.\w]]
  62. LIMIT = 1
  63.  
  64. [Stealth \w[ \r16 sec.\w]]
  65. NAME = Stealth \w[ \r16 sec.\w]
  66.  
  67. [Stealth \w[ \r16 sec.\w]]
  68. COST = 60
  69.  
  70. [Stealth \w[ \r16 sec.\w]]
  71. LIMIT = 1
  72.  
  73. [Stealth \w[ \r16 sec.\w]]
  74. NAME = Stealth \w[ \r16 sec.\w]
  75.  
  76. [Stealth \w[ \r16 sec.\w]]
  77. COST = 60
  78.  
  79. [Stealth \w[ \r16 sec.\w]]
  80. LIMIT = 1
  81.  
  82. [Stealth \w[ \r16 sec.\w]]
  83. NAME = Stealth \w[ \r16 sec.\w]
  84.  
  85. [Stealth \w[ \r16 sec.\w]]
  86. COST = 60
  87.  
  88. [Stealth \w[ \r16 sec.\w]]
  89. LIMIT = 1
  90.  
  91. [Stealth \w[ \r16 sec.\w]]
  92. NAME = Stealth \w[ \r16 sec.\w]
  93.  
  94. [Stealth \w[ \r16 sec.\w]]
  95. COST = 60
  96.  
  97. [Stealth \w[ \r16 sec.\w]]
  98. LIMIT = 1
  99.  
  100. [Stealth \w[ \r16 sec.\w]]
  101. NAME = Stealth \w[ \r16 sec.\w]
  102.  
  103. [Stealth \w[ \r16 sec.\w]]
  104. COST = 60
  105.  
  106. [Stealth \w[ \r16 sec.\w]]
  107. LIMIT = 1
  108.  
  109. [Stealth \w[ \r16 sec.\w]]
  110. NAME = Stealth \w[ \r16 sec.\w]
  111.  
  112. [Stealth \w[ \r16 sec.\w]]
  113. COST = 60
  114.  
  115. [Stealth \w[ \r16 sec.\w]]
  116. LIMIT = 1
  117.  
  118. [Stealth \w[ \r16 sec.\w]]
  119. NAME = Stealth \w[ \r16 sec.\w]
  120.  
  121. [Stealth \w[ \r16 sec.\w]]
  122. COST = 60
  123.  
  124. [Stealth \w[ \r16 sec.\w]]
  125. LIMIT = 1
  126.  
  127. [Stealth \w[ \r16 sec.\w]]
  128. NAME = Stealth \w[ \r16 sec.\w]
  129.  
  130. [Stealth \w[ \r16 sec.\w]]
  131. COST = 60
  132.  
  133. [Stealth \w[ \r16 sec.\w]]
  134. LIMIT = 1
  135.  
  136. [Stealth \w[ \r16 sec.\w]]
  137. NAME = Stealth \w[ \r16 sec.\w]
  138.  
  139. [Stealth \w[ \r16 sec.\w]]
  140. COST = 60
  141.  
  142. [Stealth \w[ \r16 sec.\w]]
  143. LIMIT = 1
  144.  
  145. [Stealth \w[ \r16 sec.\w]]
  146. NAME = Stealth \w[ \r16 sec.\w]
  147.  
  148. [Stealth \w[ \r16 sec.\w]]
  149. COST = 60
  150.  
  151. [Stealth \w[ \r16 sec.\w]]
  152. LIMIT = 1
  153.  
  154. [Stealth \w[ \r16 sec.\w]]
  155. NAME = Stealth \w[ \r16 sec.\w]
  156.  
  157. [Stealth \w[ \r16 sec.\w]]
  158. COST = 60
  159.  
  160. [Stealth \w[ \r16 sec.\w]]
  161. LIMIT = 1
  162.  
  163. [Stealth \w[ \r16 sec.\w]]
  164. NAME = Stealth \w[ \r16 sec.\w]
  165.  
  166. [Stealth \w[ \r16 sec.\w]]
  167. COST = 60
  168.  
  169. [Stealth \w[ \r16 sec.\w]]
  170. LIMIT = 1
  171.  
  172. [Stealth \w[ \r16 sec.\w]]
  173. NAME = Stealth \w[ \r16 sec.\w]
  174.  
  175. [Stealth \w[ \r16 sec.\w]]
  176. COST = 60
  177.  
  178. [Stealth \w[ \r16 sec.\w]]
  179. LIMIT = 1
  180.  
  181. [Stealth \w[ \r16 sec.\w]]
  182. NAME = Stealth \w[ \r16 sec.\w]
  183.  
  184. [Stealth \w[ \r16 sec.\w]]
  185. COST = 60
  186.  
  187. [Stealth \w[ \r16 sec.\w]]
  188. LIMIT = 1
  189.  
  190. [Stealth \w[ \r16 sec.\w]]
  191. NAME = Stealth \w[ \r16 sec.\w]
  192.  
  193. [Stealth \w[ \r16 sec.\w]]
  194. COST = 60
  195.  
  196. [Stealth \w[ \r16 sec.\w]]
  197. LIMIT = 1
  198.  
  199. [Stealth \w[ \r16 sec.\w]]
  200. NAME = Stealth \w[ \r16 sec.\w]
  201.  
  202. [Stealth \w[ \r16 sec.\w]]
  203. COST = 60
  204.  
  205. [Stealth \w[ \r16 sec.\w]]
  206. LIMIT = 1
  207.  
  208. [Stealth \w[ \r16 sec.\w]]
  209. NAME = Stealth \w[ \r16 sec.\w]
  210.  
  211. [Stealth \w[ \r16 sec.\w]]
  212. COST = 60
  213.  
  214. [Stealth \w[ \r16 sec.\w]]
  215. LIMIT = 1
  216.  
  217. [Stealth \w[ \r16 sec.\w]]
  218. NAME = Stealth \w[ \r16 sec.\w]
  219.  
  220. [Stealth \w[ \r16 sec.\w]]
  221. COST = 60
  222.  
  223. [Stealth \w[ \r16 sec.\w]]
  224. LIMIT = 1
  225.  
  226. [Stealth \w[ \r16 sec.\w]]
  227. NAME = Stealth \w[ \r16 sec.\w]
  228.  
  229. [Stealth \w[ \r16 sec.\w]]
  230. COST = 60
  231.  
  232. [Stealth \w[ \r16 sec.\w]]
  233. LIMIT = 1
  234.  
  235. [Stealth \w[ \r16 sec.\w]]
  236. NAME = Stealth \w[ \r16 sec.\w]
  237.  
  238. [Stealth \w[ \r16 sec.\w]]
  239. COST = 60
  240.  
  241. [Stealth \w[ \r16 sec.\w]]
  242. LIMIT = 1
  243.  
  244. [Stealth \w[ \r16 sec.\w]]
  245. NAME = Stealth \w[ \r16 sec.\w]
  246.  
  247. [Stealth \w[ \r16 sec.\w]]
  248. COST = 60
  249.  
  250. [Stealth \w[ \r16 sec.\w]]
  251. LIMIT = 1
  252.  
  253. [Stealth \w[ \r16 sec.\w]]
  254. NAME = Stealth \w[ \r16 sec.\w]
  255.  
  256. [Stealth \w[ \r16 sec.\w]]
  257. COST = 60
  258.  
  259. [Stealth \w[ \r16 sec.\w]]
  260. LIMIT = 1
  261.  
  262. [Stealth \w[ \r16 sec.\w]]
  263. NAME = Stealth \w[ \r16 sec.\w]
  264.  
  265. [Stealth \w[ \r16 sec.\w]]
  266. COST = 60
  267.  
  268. [Stealth \w[ \r16 sec.\w]]
  269. LIMIT = 1
  270.  
  271. [Stealth \w[ \r16 sec.\w]]
  272. NAME = Stealth \w[ \r16 sec.\w]
  273.  
  274. [Stealth \w[ \r16 sec.\w]]
  275. COST = 60
  276.  
  277. [Stealth \w[ \r16 sec.\w]]
  278. LIMIT = 1
  279.  
  280. [Stealth \w[ \r16 sec.\w]]
  281. NAME = Stealth \w[ \r16 sec.\w]
  282.  
  283. [Stealth \w[ \r16 sec.\w]]
  284. COST = 60
  285.  
  286. [Stealth \w[ \r16 sec.\w]]
  287. LIMIT = 1
  288.  
  289. [Stealth \w[ \r16 sec.\w]]
  290. NAME = Stealth \w[ \r16 sec.\w]
  291.  
  292. [Stealth \w[ \r16 sec.\w]]
  293. COST = 60
  294.  
  295. [Stealth \w[ \r16 sec.\w]]
  296. LIMIT = 1
  297.  
  298. [Stealth \w[ \r16 sec.\w]]
  299. NAME = Stealth \w[ \r16 sec.\w]
  300.  
  301. [Stealth \w[ \r16 sec.\w]]
  302. COST = 60
  303.  
  304. [Stealth \w[ \r16 sec.\w]]
  305. LIMIT = 1
  306.  
  307. [Stealth \w[ \r16 sec.\w]]
  308. NAME = Stealth \w[ \r16 sec.\w]
  309.  
  310. [Stealth \w[ \r16 sec.\w]]
  311. COST = 60
  312.  
  313. [Stealth \w[ \r16 sec.\w]]
  314. LIMIT = 1
  315.  
  316. [Stealth \w[ \r16 sec.\w]]
  317. NAME = Stealth \w[ \r16 sec.\w]
  318.  
  319. [Stealth \w[ \r16 sec.\w]]
  320. COST = 60
  321.  
  322. [Stealth \w[ \r16 sec.\w]]
  323. LIMIT = 1
  324.  
  325. [Stealth \w[ \r16 sec.\w]]
  326. NAME = Stealth \w[ \r16 sec.\w]
  327.  
  328. [Stealth \w[ \r16 sec.\w]]
  329. COST = 60
  330.  
  331. [Stealth \w[ \r16 sec.\w]]
  332. LIMIT = 1
  333.  
  334. [Stealth \w[ \r16 sec.\w]]
  335. NAME = Stealth \w[ \r16 sec.\w]
  336.  
  337. [Stealth \w[ \r16 sec.\w]]
  338. COST = 60
  339.  
  340. [Stealth \w[ \r16 sec.\w]]
  341. LIMIT = 1
  342.  
  343. [Stealth \w[ \r16 sec.\w]]
  344. NAME = Stealth \w[ \r16 sec.\w]
  345.  
  346. [Stealth \w[ \r16 sec.\w]]
  347. COST = 60
  348.  
  349. [Stealth \w[ \r16 sec.\w]]
  350. LIMIT = 1
  351.  
  352. [Stealth \w[ \r16 sec.\w]]
  353. NAME = Stealth \w[ \r16 sec.\w]
  354.  
  355. [Stealth \w[ \r16 sec.\w]]
  356. COST = 60
  357.  
  358. [Stealth \w[ \r16 sec.\w]]
  359. LIMIT = 1
  360.  
  361. [Stealth \w[ \r16 sec.\w]]
  362. NAME = Stealth \w[ \r16 sec.\w]
  363.  
  364. [Stealth \w[ \r16 sec.\w]]
  365. COST = 60
  366.  
  367. [Stealth \w[ \r16 sec.\w]]
  368. LIMIT = 1
  369.  
  370. [Stealth \w[ \r16 sec.\w]]
  371. NAME = Stealth \w[ \r16 sec.\w]
  372.  
  373. [Stealth \w[ \r16 sec.\w]]
  374. COST = 60
  375.  
  376. [Stealth \w[ \r16 sec.\w]]
  377. LIMIT = 1
  378.  
  379. [Stealth \w[ \r16 sec.\w]]
  380. NAME = Stealth \w[ \r16 sec.\w]
  381.  
  382. [Stealth \w[ \r16 sec.\w]]
  383. COST = 60
  384.  
  385. [Stealth \w[ \r16 sec.\w]]
  386. LIMIT = 1
  387.  
  388. [Stealth \w[ \r16 sec.\w]]
  389. NAME = Stealth \w[ \r16 sec.\w]
  390.  
  391. [Stealth \w[ \r16 sec.\w]]
  392. COST = 60
  393.  
  394. [Stealth \w[ \r16 sec.\w]]
  395. LIMIT = 1
  396.  
  397. [Stealth \w[ \r16 sec.\w]]
  398. NAME = Stealth \w[ \r16 sec.\w]
  399.  
  400. [Stealth \w[ \r16 sec.\w]]
  401. COST = 60
  402.  
  403. [Stealth \w[ \r16 sec.\w]]
  404. LIMIT = 1
  405.  
  406. [Stealth \w[ \r16 sec.\w]]
  407. NAME = Stealth \w[ \r16 sec.\w]
  408.  
  409. [Stealth \w[ \r16 sec.\w]]
  410. COST = 60
  411.  
  412. [Stealth \w[ \r16 sec.\w]]
  413. LIMIT = 1
  414.  
  415. [Stealth \w[ \r16 sec.\w]]
  416. NAME = Stealth \w[ \r16 sec.\w]
  417.  
  418. [Stealth \w[ \r16 sec.\w]]
  419. COST = 60
  420.  
  421. [Stealth \w[ \r16 sec.\w]]
  422. LIMIT = 1
  423.  
  424. [Stealth \w[ \r16 sec.\w]]
  425. NAME = Stealth \w[ \r16 sec.\w]
  426.  
  427. [Stealth \w[ \r16 sec.\w]]
  428. COST = 60
  429.  
  430. [Stealth \w[ \r16 sec.\w]]
  431. LIMIT = 1
  432.  
  433. [Stealth \w[ \r16 sec.\w]]
  434. NAME = Stealth \w[ \r16 sec.\w]
  435.  
  436. [Stealth \w[ \r16 sec.\w]]
  437. COST = 60
  438.  
  439. [Stealth \w[ \r16 sec.\w]]
  440. LIMIT = 1
  441.  
  442. [Stealth \w[ \r16 sec.\w]]
  443. NAME = Stealth \w[ \r16 sec.\w]
  444.  
  445. [Stealth \w[ \r16 sec.\w]]
  446. COST = 60
  447.  
  448. [Stealth \w[ \r16 sec.\w]]
  449. LIMIT = 1
  450.  
  451. [Stealth \w[ \r16 sec.\w]]
  452. NAME = Stealth \w[ \r16 sec.\w]
  453.  
  454. [Stealth \w[ \r16 sec.\w]]
  455. COST = 60
  456.  
  457. [Stealth \w[ \r16 sec.\w]]
  458. LIMIT = 1
  459.  
  460. [Stealth \w[ \r16 sec.\w]]
  461. NAME = Stealth \w[ \r16 sec.\w]
  462.  
  463. [Stealth \w[ \r16 sec.\w]]
  464. COST = 60
  465.  
  466. [Stealth \w[ \r16 sec.\w]]
  467. LIMIT = 1
  468.  
  469. [Stealth \w[ \r16 sec.\w]]
  470. NAME = Stealth \w[ \r16 sec.\w]
  471.  
  472. [Stealth \w[ \r16 sec.\w]]
  473. COST = 60
  474.  
  475. [Stealth \w[ \r16 sec.\w]]
  476. LIMIT = 1
  477.  
  478. [Stealth \w[ \r16 sec.\w]]
  479. NAME = Stealth \w[ \r16 sec.\w]
  480.  
  481. [Stealth \w[ \r16 sec.\w]]
  482. COST = 60
  483.  
  484. [Stealth \w[ \r16 sec.\w]]
  485. LIMIT = 1
  486.  
  487. [Stealth \w[ \r16 sec.\w]]
  488. NAME = Stealth \w[ \r16 sec.\w]
  489.  
  490. [Stealth \w[ \r16 sec.\w]]
  491. COST = 60
  492.  
  493. [Stealth \w[ \r16 sec.\w]]
  494. LIMIT = 1
  495.  
  496. [Stealth \w[ \r16 sec.\w]]
  497. NAME = Stealth \w[ \r16 sec.\w]
  498.  
  499. [Stealth \w[ \r16 sec.\w]]
  500. COST = 60
  501.  
  502. [Stealth \w[ \r16 sec.\w]]
  503. LIMIT = 1
  504.  
  505. [Stealth \w[ \r16 sec.\w]]
  506. NAME = Stealth \w[ \r16 sec.\w]
  507.  
  508. [Stealth \w[ \r16 sec.\w]]
  509. COST = 60
  510.  
  511. [Stealth \w[ \r16 sec.\w]]
  512. LIMIT = 1
  513.  
  514. [Stealth \w[ \r16 sec.\w]]
  515. NAME = Stealth \w[ \r16 sec.\w]
  516.  
  517. [Stealth \w[ \r16 sec.\w]]
  518. COST = 60
  519.  
  520. [Stealth \w[ \r16 sec.\w]]
  521. LIMIT = 1
  522.  
  523. [Stealth \w[ \r16 sec.\w]]
  524. NAME = Stealth \w[ \r16 sec.\w]
  525.  
  526. [Stealth \w[ \r16 sec.\w]]
  527. COST = 60
  528.  
  529. [Stealth \w[ \r16 sec.\w]]
  530. LIMIT = 1
  531.  
  532. [Stealth \w[ \r16 sec.\w]]
  533. NAME = Stealth \w[ \r16 sec.\w]
  534.  
  535. [Stealth \w[ \r16 sec.\w]]
  536. COST = 60
  537.  
  538. [Stealth \w[ \r16 sec.\w]]
  539. LIMIT = 1
  540.  
  541. [Stealth \w[ \r16 sec.\w]]
  542. NAME = Stealth \w[ \r16 sec.\w]
  543.  
  544. [Stealth \w[ \r16 sec.\w]]
  545. COST = 60
  546.  
  547. [Stealth \w[ \r16 sec.\w]]
  548. LIMIT = 1
  549.  
  550. [Stealth \w[ \r16 sec.\w]]
  551. NAME = Stealth \w[ \r16 sec.\w]
  552.  
  553. [Stealth \w[ \r16 sec.\w]]
  554. COST = 60
  555.  
  556. [Stealth \w[ \r16 sec.\w]]
  557. LIMIT = 1
  558.  
  559. [Stealth \w[ \r16 sec.\w]]
  560. NAME = Stealth \w[ \r16 sec.\w]
  561.  
  562. [Stealth \w[ \r16 sec.\w]]
  563. COST = 60
  564.  
  565. [Stealth \w[ \r16 sec.\w]]
  566. LIMIT = 1
  567.  
  568. [Stealth \w[ \r16 sec.\w]]
  569. NAME = Stealth \w[ \r16 sec.\w]
  570.  
  571. [Stealth \w[ \r16 sec.\w]]
  572. COST = 60
  573.  
  574. [Stealth \w[ \r16 sec.\w]]
  575. LIMIT = 1
  576.  
  577. [Stealth \w[ \r16 sec.\w]]
  578. NAME = Stealth \w[ \r16 sec.\w]
  579.  
  580. [Stealth \w[ \r16 sec.\w]]
  581. COST = 60
  582.  
  583. [Stealth \w[ \r16 sec.\w]]
  584. LIMIT = 1

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1717
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#56

Post by Raheem » 2 Months Ago

What is this?

And how many items you have in your server?
You don't know? Learn and you will know.

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

#57

Post by Mark » 2 Months Ago

Raheem wrote:
2 Months Ago
What is this?

And how many items you have in your server?
That was not it i fixed that problem and it still happened.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1717
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#58

Post by Raheem » 2 Months Ago

Yes count items you have in your server and let me know the number.
You don't know? Learn and you will know.

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

#59

Post by Mark » 2 Months Ago

Raheem wrote:
2 Months Ago
What is this?

And how many items you have in your server?
43

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1717
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#60

Post by Raheem » 2 Months Ago

Go to zombie_escape.inc and change: Then recompile items manager and all plugins that uses MAX_EXTRA_ITEMS.

Maybe these:
  • ze_items_manager.sma
    ze_items_limit.sma
    ze_items_level.sma
    ze_items_vip.sma
And you check maybe ze_items_escape_coins.sma also.
You don't know? Learn and you will know.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests