BR

(Bug) AutoLoot

Por BrunooMaciell, 21 de ago. de 2020 em Scripts

5
2.2k
BrunooMaciellB
21 de agosto de 2020 às 23:19

Estou com um BUG no autoloot.

 

BUG

[21/08/2020 23:13:54] [Error - Action Interface] 
[21/08/2020 23:13:54] data/actions/scripts/Autoloot.lua:onUse
[21/08/2020 23:13:54] Description: 
[21/08/2020 23:13:54] data/actions/scripts/Autoloot.lua:11: attempt to perform arithmetic on a boolean value
[21/08/2020 23:13:54] stack traceback:
[21/08/2020 23:13:54] 	data/actions/scripts/Autoloot.lua:11: in function <data/actions/scripts/Autoloot.lua:5>

SCRIPT

local toloot = {11441, 11442, 11443, 11444, 11445, 11446, 11447, 11448, 11449,11450, 11451, 11452, 11453, 11454, 12618, 12232, 12244} -- PREFERENCIAL - SE QUISER APENAS COM ALGUNS ITENS


local useSpecific = false --True para lotear somente os itens que estiverem na tabela toloot, false para todos os itens do corpse
function onUse(cid, item, frompos, item2, topos)
if getItemAttribute(item.uid, "corpseowner") ~= cid then
doPlayerSendCancel(cid, "Você não é o proprietário.")
return true
end
local items = {}
for x = (getContainerSize(item.uid) - 1), 0, -1 do
local k = getContainerItem(item.uid, x)
table.insert(items, {i=k.itemid, q=k.type})
doRemoveItem(k.uid)
end
if #items == nil then
return false
end
for y=1, #items do
doPlayerAddItemStacking(cid, items[y].i, items[y].q)
doPlayerSendTextMessage(cid, 20, "Looted "..items[y].q.."x "..getItemNameById(items[y].i)..".")
end
return true
end
--[[
AUTO LOOT BY GABRIEL SALES
SE QUISER ATIVAR O AUTOLOOT APENAS PARA ALGUNS ITENS, ADICIONE OS IDS NA TABELA toloot E TIRE OS COMENTÁRIOS(--).
--]]

Rep++

PoccnnP
25 de agosto de 2020 às 09:05
Melhor resposta

isso pode ocorrer porque o corpo não possa "abrir".

BrunooMaciellB
25 de agosto de 2020 às 10:10
1 hora atrás, Poccnn disse:

isso pode ocorrer porque o corpo não possa "abrir".

A blz ^^

 

VlW

raulcdjR
26 de agosto de 2020 às 11:54
Em 25/08/2020 em 10:10, BrunooMaciell disse:

A blz ^^

 

VlW

você conseguiu arruma esse erro

2 anos depois...
14 de abril de 2023 às 18:55

@raulcdj Deve resolver o problema de vcs
 

local toloot = {11441, 11442, 11443, 11444, 11445, 11446, 11447, 11448, 11449,11450, 11451, 11452, 11453, 11454, 12618, 12232, 12244} -- PREFERENCIAL - SE QUISER APENAS COM ALGUNS ITENS

local useSpecific = false --True para lotear somente os itens que estiverem na tabela toloot, false para todos os itens do corpse

function onUse(cid, item, frompos, item2, topos)
local corpseOwner = getItemAttribute(item.uid, "corpseowner")
if corpseOwner and corpseOwner ~= cid then
doPlayerSendCancel(cid, "Você não é o proprietário.")
return true
end
local items = {}
for x = (getContainerSize(item.uid) - 1), 0, -1 do
    local k = getContainerItem(item.uid, x)
    table.insert(items, {i=k.itemid, q=k.type})
    doRemoveItem(k.uid)
end

if #items == nil then
    return false
end

for y=1, #items do
    -- Verifica se o item está na tabela toloot ou se useSpecific é false
    if useSpecific == false or table.contains(toloot, items[y].i) then
        doPlayerAddItemStacking(cid, items[y].i, items[y].q)
        doPlayerSendTextMessage(cid, 20, "Looted "..items[y].q.."x "..getItemNameById(items[y].i)..".")
    end
end

return true
end