local removable = {1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 7343, 7342, 5949, 5950, 10518, 10519, 10520, 10521, 10522, 9774, 3940, 5926, 11235, 11238}
function removeEmptyContainers(uid, ids)
local ret, i = 0, 0
while i < getContainerSize(uid) do
local v = getContainerItem(uid, i)
if isContainer(v.uid) then
if getContainerSize(v.uid) ~= 0 then
ret = ret + removeEmptyContainers(v.uid, removable)
if isInArray(removable, v.itemid) and getContainerSize(v.uid) == 0 then
i = i - 1
end
elseif isInArray(removable, v.itemid) then
doRemoveItem(v.uid)
i = i - 1
ret = ret + 1
end
end
i = i + 1
end
return ret
end
function onSay(cid, words, param, channel)
local ret = 0
for i = 1, 10 do
local v = getPlayerSlotItem(cid, i).uid
if v > 0 and isContainer(v) then
ret = ret + removeEmptyContainers(v, removable)
end
end
ret = tostring(ret)
return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, ret .. " empty container" .. (ret:sub(-1) == "1" and ret:sub(-2) ~= "11" and "" or "s") .. " removed.")
end