Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function playerRemoveItems(player, remove)
- local lookup = {}
- for k, v in ipairs(remove) do
- lookup[v] = true
- end
- local containers = {}
- for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
- local slotItem = player:getSlotItem(i)
- if slotItem then
- if lookup[slotItem:getId()] then
- slotItem:remove()
- elseif slotItem:isContainer() then
- table.insert(containers, slotItem)
- end
- end
- end
- while #containers > 0 do
- local container = table.remove(containers, #containers)
- for i = 0, container:getSize() - 1 do
- local item = container:getItem(i)
- if lookup[item:getId()] then
- item:remove()
- elseif item:isContainer() then
- table.insert(containers, item)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement