Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function BuildItemMenu(menu, ply, itemstype, callback)
- local plyitems = ply:PS_GetItems()
- for category_id, CATEGORY in pairs(PS.Categories) do
- local catmenu = menu:AddSubMenu(CATEGORY.Name)
- table.SortByMember(PS.Items, PS.Config.SortItemsBy, function(a, b) return a > b end)
- for item_id, ITEM in pairs(PS.Items) do
- if ITEM.Category == CATEGORY.Name then
- if itemstype == ALL_ITEMS or (itemstype == OWNED_ITEMS and plyitems[item_id]) or (itemstype == UNOWNED_ITEMS and not plyitems[item_id]) then
- catmenu:AddOption(ITEM.Name, function() callback(item_id) end)
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement