WikiArk21
New Member
- Joined
- Oct 24, 2023
- Messages
- 16
- Reaction score
- 1
I am trying to make a quickloot for my server, and I have partially succeeded, but it pulls one item for each click on the monster's body. How can I fix this error? It is an action, etc.
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getItemAttribute(item.uid, "corpseowner") ~= getPlayerGUID(cid) then
return doPlayerSendCancel(cid, "Esse corpo foi morto por outro jogador")
end
local items = {}
for i = 1, getContainerSize(item.uid) do
local it = getContainerItem(item.uid, i - 1)
if it.uid > 0 then
table.insert(items, {it.itemid, it.type})
doRemoveItem(it.uid)
end
end
if #items > 0 then
for k = 1, #items do
local playerItem = getPlayerItemById(cid, true, items[k][1])
if playerItem.uid > 0 then
local totalType = playerItem.type + items[k][2]
if totalType > 100 then
doPlayerAddItem(cid, items[k][1], totalType - 100)
doTransformItem(playerItem.uid, items[k][1], 100)
else
doTransformItem(playerItem.uid, items[k][1], totalType)
end
else
doPlayerAddItem(cid, items[k][1], items[k][2])
end
end
return true
end
return false
end