Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. local function BuildItemMenu(menu, ply, itemstype, callback)
  2. local plyitems = ply:PS_GetItems()
  3.  
  4. for category_id, CATEGORY in pairs(PS.Categories) do
  5.  
  6. local catmenu = menu:AddSubMenu(CATEGORY.Name)
  7.  
  8. table.SortByMember(PS.Items, PS.Config.SortItemsBy, function(a, b) return a > b end)
  9.  
  10. for item_id, ITEM in pairs(PS.Items) do
  11. if ITEM.Category == CATEGORY.Name then
  12. if itemstype == ALL_ITEMS or (itemstype == OWNED_ITEMS and plyitems[item_id]) or (itemstype == UNOWNED_ITEMS and not plyitems[item_id]) then
  13. catmenu:AddOption(ITEM.Name, function() callback(item_id) end)
  14. end
  15. end
  16. end
  17. end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement