Postado Agosto 12, 2020 4 anos BOA NOITE A TODOS DO TK!! Preciso de uma ajudinha com um systema de Autoloot do Meu Projeto de Poketibia! Eu Gostaria que alguem Pudese Fazer uma Pequena Modificação nele. a modificação seria adicionar uma lista aonde iria bloquear de o autoloot puxar para pokebag. Exemplo: Fire Stone Se alguem puder fazer essa modificação Ja Agradeço!! Irei deixar o codigo para edição! Spoiler function onUse(cid, item, fromPosition, itemEx, toPosition) if getItemAttribute(item.uid, "corpseowner") ~= cid then return doPlayerSendCancel(cid, "You're not the owner.") end local items = {} for i = 0, getContainerSize(item.uid) do local it = getContainerItem(item.uid, i) 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 if (playerItem.type + items[k][2]) > 100 then doPlayerAddItem(cid, items[k][1], (playerItem.type + items[k][2]) - 100) doTransformItem(playerItem.uid, items[k][1], 100) else doTransformItem(playerItem.uid, items[k][1], playerItem.type + items[k][2]) end else doPlayerAddItem(cid, items[k][1], items[k][2]) end end return true end doSetItemActionId(item.uid, 0) return false end Editado Agosto 12, 2020 4 anos por El Reverso Erros (veja o histórico de edições)
Postado Agosto 12, 2020 4 anos @El Reverso não testei mas tenta ai, ve o que da ---- REPOSTA EDITADA ---- esse é o script funcional, pra vcs n precisarem ir até a pag 2 p pegar o sistema funcionando local blocked_items = {8413, 5726} -- adicione aqui os itens que vc quer bloquear separados por , function onUse(cid, item, fromPosition, itemEx, toPosition) if getItemAttribute(item.uid, "corpseowner") ~= cid then return doPlayerSendCancel(cid, "You're not the owner.") end local items = {} for i = 0, getContainerSize(item.uid) do local it = getContainerItem(item.uid, i) if it.uid > 0 and not isInArray(blocked_items,it.itemid) 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 if (playerItem.type + items[k][2]) > 100 then doPlayerAddItem(cid, items[k][1], (playerItem.type + items[k][2]) - 100) doTransformItem(playerItem.uid, items[k][1], 100) else doTransformItem(playerItem.uid, items[k][1], playerItem.type + items[k][2]) end else doPlayerAddItem(cid, items[k][1], items[k][2]) end end return true end doSetItemActionId(item.uid, 0) return false end Editado Agosto 12, 2020 4 anos por Lurk (veja o histórico de edições)
Postado Agosto 12, 2020 4 anos Autor @Gabrieldsadaxas boa tarde, desculpe a demora por responder irei testa-lo imediatamente!. @Gabrieldsadaxas testei aqui amigo, ele coletou o loot normalmente, é ocorreu este erro na distro. [12/08/2020 14:03:05] [Error - Action Interface] [12/08/2020 14:03:05] data/actions/scripts/autoloot.lua:onUse [12/08/2020 14:03:05] Description: [12/08/2020 14:03:05] data/actions/scripts/autoloot.lua:17: attempt to index global 'it' (a nil value) [12/08/2020 14:03:05] stack traceback: [12/08/2020 14:03:05] data/actions/scripts/autoloot.lua:17: in function <data/actions/scripts/autoloot.lua:2>
Postado Agosto 12, 2020 4 anos @El Reverso kkkkkkkkkkkkkkkkk comi umas 5 letras da palavra foi mal, troca if playerItem.uid > 0 and not isInArray(blocked_items,it.uid) then por if playerItem.uid > 0 and not isInArray(blocked_items, playerItem.uid) then e me diz o que rola
Postado Agosto 12, 2020 4 anos Autor @Gabrieldsadaxas kk fiz a troca de linhas, esta coletando normalmente, não esta aparecendo nemhum erro na distro so que ainda esta coletando o ''item'' que era pra ser bloqueado no autoloot.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.