leyendario
kind of scripter
this is a function that returns a table with all items that the player currently have. it doesn't count depot.
use:
Code:
function getPlayerItems(cid)
local items = {}
local function checkContainer(uid)
local container = getContainerSize(uid) - 1
for a = 0, container do
local item = getContainerItem(uid,a)
if item.uid > 0 then
table.insert(items,item.uid)
if isContainer(item.uid) then
checkContainer(item.uid)
end
end
end
end
local player = getThing(cid)
if isPlayer(cid) then
for i = 0, 10 do
local slot = getPlayerSlotItem(cid,i)
if slot.uid > 0 then
table.insert(items,slot.uid)
if isContainer(slot.uid) then
checkContainer(slot.uid)
end
end
end
return items
end
return false
end
use:
Code:
local items = getPlayerItems(cid)
if items then
for _, item in ipairs(items)
...
end
else
...
end
Last edited: