já penso em tirar isso do começo -- isso se usar para comentários e vc ta fazendo na sua variável so tirar e pronto. na verdade la embaixo no script vc tb tem outros comentários.
- Fórum
- OTServ
- Suporte
- Resolvidos
- (resolvido) (Bug) Auto Loot System
(resolvido) (Bug) Auto Loot System
Por BrunooMaciell, 17 de dez. de 2016 em Resolvidos
Editado Dezembro 17 por nociam
info
Grupo: Conde
Registrado: 18/01/12
Posts: 988
Reputação: +327
Gênero: Masculino
Char no Tibia: Xerife Woody

46 minutos atrás, brunoo1996 disse:Estou com um bug no auto loot system.
BUG
[17/12/2016 03:39:55] [Error - LuaScriptInterface::loadFile] data/actions/scripts/autoloot.lua:2: unexpected symbol near '11847'
[17/12/2016 03:39:55] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/autoloot.lua)
[17/12/2016 03:39:55] data/actions/scripts/autoloot.lua:2: unexpected symbol near '11847'
SCRIPT
--local toloot = {12706,11850,11860,11861,11869,11871,11872,11873,11878,11881,11849,11864,11863,11859,11854,11853,11852,11851,11838,11839,11840,11844,11846,
11847,11848,11855,11856,11858,11865,11866,11867,11875,11876,11877,11879,11883,11884,11885,12140,12764,11886,11887,11888,11889,11890,11891,11892,11893,11894
,11895,11896,11897,11898,11899,11900,11901,11902,11903,11904,11905,11906,11907,11908,11909,11910,11911,11912,11913,12747,11914,11915,11916,11917
,11918,11919,11920,11921,11922,11923,11924,11925,11926,11927,11928,11929,11930,11931,11932,11933,11934,11935,11936,11937,11938,11939,11940,11941,11942,11943,11944,11945,11946,11947,11948,11950,11951,11952,11953,11954,11955,11956,11957,11958,11959,
11960,11961,11962,11963,11964,11965,11966,11967,11968,11969,11970,11971,11972,11973,11974,11975,11976,11977,11978,11979,11980,11981,11982,11983,11984,11985,11986,11987,11988,3267,3268,3269,3270,3271,3272,3273,3274,3275,3276,3277,3278,3279,3280,3281,3282,3283,3284,3556,3285,3286,3287,3288,3289,3290,3291,3292,3293,6043,8937,8941,5964,237,212,6003,5976,12556,12549,9925,12711,12722,620,12729,614,12720,2858,216,12583,9823,9801,9803,6076,30
02,3294,3295,3296,3297,3553,3555,3557,3558,3559,3560,3561,3562,3563,3564,3565,3566,3567,3575,3576,3577,3578,3579,3580,
3581,3582,3583,3584,3585,3586,4422,4423,4424,4425,4426,4427,4428,4429,4431,4432,4430,4433,4434,4435,4436,4437,4438,4439,4440,4441,4442,4443,4444,4445,4446,4447,4448,4449,4450,4451,4452,4453,4454,4455,4567,4568,4569,4756,4757,4758,4759,12765,596,12766,592
,593,594,597,12767,12708,604,12737,12744,12756,606,607,608,12754,12752,12736,609,611,610,612,12753,615,713,616,12710,618,617,619,12738,1665,12662,12727,12748,12698,12697,12749,12670,12762,12719,622,12686,613,12728,2824,624,12696,595,625,12739,12682,12679,12733,12683,12751,12684,12627,12685,621,12761,12721,12687,12689,12692,12769,12760,12694,297,12742,12768,12690,12691,12741,12771,12702,12731,2020,12746,12693,12695,12707,12699,590,591,12700,603,588,12715,12701,12704,12745,602,12703,12705,12709,12713,12724,12750,12755,12714,12717,12718,12770,623,12757,12723,12763,12725,589,12726,12712,12743,587,12716,605,12730,12735,12759,12740,261,165,179,153,151,233,230,228,198,181,251,204,202,115,191,
173,247,135,245,171,169,133,125,253,200,129,131,112,214,127,220,265,235,12781,239,241,206,119,155,157,267,218,143,255,161,163,102,139,257,167,118,189,196,121,123,222,141,208,210,177,3568,243
,226,259,149,147,145,224,269,137,113,249,107,193,263,183,185,187,271,12482,12484,12570,12478,12598,12434,12431,12425,12792,12524,12604,12568,12569,12567,12545,12520,12600,12502,12513,12461,12507,12477,12550,12536,12544,12518,12517,12796,12773,12790,12599,12525,12577,12595,12508,12597,12462,12582,12465,12466,12437,12547,12601,12794,12445,12439,12438,12596,12543,12537,12563,12603,12534,12564,12491,12492,12800,12602,12468,12467,12422,12519,12561,12460}
function onUse(cid, item, frompos, item2, topos)
if getItemAttribute(item.uid, "corpseowner") ~= cid then
doPlayerSendCancel(cid, "You're not the owner.")
return true
end
local items = {}
for x=0, (getContainerSize(item.uid)) do
local itens = getContainerItem(item.uid,
--if isInArray(toloot, itens.itemid) then
table.insert(items, {i=itens.itemid, q=itens.type})
doRemoveItem(itens.uid)
--break
--end
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
if #items > 0 then
return true
else
return false
end
end
Quem puder me ajudar ^^
Rep++
--local toloot = << a tabela tá como comentário. Exclui os --
deixa assim : local toloot =
info
Grupo: Infante
Registrado: 27/08/11
Posts: 1.9k
Reputação: +85
Gênero: Masculino
Char no Tibia: Bruno Maciel

Bug ainda continua =/
[17/12/2016 04:14:56] [Error - LuaScriptInterface::loadFile] data/actions/scripts/autoloot.lua:6: '}' expected (to close '{' at line 1) near '02'
[17/12/2016 04:14:56] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/autoloot.lua)
[17/12/2016 04:14:56] data/actions/scripts/autoloot.lua:6: '}' expected (to close '{' at line 1) near '02'
up =/
info
Grupo: Visconde
Registrado: 20/03/14
Posts: 367
Reputação: +219
Gênero: Masculino

local toloot = {12706,11850,11860,11861,11869,11871,11872,11873,11878,11881,11849,11864,11863,11859,11854,11853,11852,11851,11838,11839,11840,11844,11846,11847,11848,11855,11856,11858,11865,11866,11867,11875,11876,11877,11879,11883,11884,11885,12140,12764,11886,11887,11888,11889,11890,11891,11892,11893,11894,11895,11896,11897,11898,11899,11900,11901,11902,11903,11904,11905,11906,11907,11908,11909,11910,11911,11912,11913,12747,11914,11915,11916,11917,11918,11919,11920,11921,11922,11923,11924,11925,11926,11927,11928,11929,11930,11931,11932,11933,11934,11935,11936,11937,11938,11939,11940,11941,11942,11943,11944,11945,11946,11947,11948,11950,11951,11952,11953,11954,11955,11956,11957,11958,11959,11960,11961,11962,11963,11964,11965,11966,11967,11968,11969,11970,11971,11972,11973,11974,11975,11976,11977,11978,11979,11980,11981,11982,11983,11984,11985,11986,11987,11988,3267,3268,3269,3270,3271,3272,3273,3274,3275,3276,3277,3278,3279,3280,3281,3282,3283,3284,3556,3285,3286,3287,3288,3289,3290,3291,3292,3293,6043,8937,8941,5964,237,212,6003,5976,12556,12549,9925,12711,12722,620,12729,614,12720,2858,216,12583,9823,9801,9803,6076,3002,3294,3295,3296,3297,3553,3555,3557,3558,3559,3560,3561,3562,3563,3564,3565,3566,3567,3575,3576,3577,3578,3579,3580,3581,3582,3583,3584,3585,3586,4422,4423,4424,4425,4426,4427,4428,4429,4431,4432,4430,4433,4434,4435,4436,4437,4438,4439,4440,4441,4442,4443,4444,4445,4446,4447,4448,4449,4450,4451,4452,4453,4454,4455,4567,4568,4569,4756,4757,4758,4759,12765,596,12766,592,593,594,597,12767,12708,604,12737,12744,12756,606,607,608,12754,12752,12736,609,611,610,612,12753,615,713,616,12710,618,617,619,12738,1665,12662,12727,12748,12698,12697,12749,12670,12762,12719,622,12686,613,12728,2824,624,12696,595,625,12739,12682,12679,12733,12683,12751,12684,12627,12685,621,12761,12721,12687,12689,12692,12769,12760,12694,297,12742,12768,12690,12691,12741,12771,12702,12731,2020,12746,12693,12695,12707,12699,590,591,12700,603,588,12715,12701,12704,12745,602,12703,12705,12709,12713,12724,12750,12755,12714,12717,12718,12770,623,12757,12723,12763,12725,589,12726,12712,12743,587,12716,605,12730,12735,12759,12740,261,165,179,153,151,233,230,228,198,181,251,204,202,115,191,173,247,135,245,171,169,133,125,253,200,129,131,112,214,127,220,265,235,12781,239,241,206,119,155,157,267,218,143,255,161,163,102,139,257,167,118,189,196,121,123,222,141,208,210,177,3568,243,226,259,149,147,145,224,269,137,113,249,107,193,263,183,185,187,271,12482,12484,12570,12478,12598,12434,12431,12425,12792,12524,12604,12568,12569,12567,12545,12520,12600,12502,12513,12461,12507,12477,12550,12536,12544,12518,12517,12796,12773,12790,12599,12525,12577,12595,12508,12597,12462,12582,12465,12466,12437,12547,12601,12794,12445,12439,12438,12596,12543,12537,12563,12603,12534,12564,12491,12492,12800,12602,12468,12467,12422,12519,12561,12460}function onUse(cid, item, frompos, item2, topos) if getItemAttribute(item.uid, "corpseowner") ~= cid then doPlayerSendCancel(cid, "You're not the owner.") return true end local items = {} for x=0, (getContainerSize(item.uid)) do local itens = getContainerItem(item.uid, X) --if isInArray(toloot, itens.itemid) then table.insert(items, {i=itens.itemid, q=itens.type}) doRemoveItem(itens.uid) --break --end 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 if #items > 0 then return true else return false endend
ou como não está usando a tabela poderá deixar assim
function onUse(cid, item, frompos, item2, topos) if getItemAttribute(item.uid, "corpseowner") ~= cid then doPlayerSendCancel(cid, "You're not the owner.") return true end local items = {} for x=0, (getContainerSize(item.uid)) do local itens = getContainerItem(item.uid, X) table.insert(items, {i=itens.itemid, q=itens.type}) doRemoveItem(itens.uid) 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 if #items > 0 then return true else return false endend
Editado Dezembro 17 por Drakopoulos
info
Grupo: Infante
Registrado: 27/08/11
Posts: 1.9k
Reputação: +85
Gênero: Masculino
Char no Tibia: Bruno Maciel

Agora, Drakopoulos disse:local toloot = {12706,11850,11860,11861,11869,11871,11872,11873,11878,11881,11849,11864,11863,11859,11854,11853,11852,11851,11838,11839,11840,11844,11846,11847,11848,11855,11856,11858,11865,11866,11867,11875,11876,11877,11879,11883,11884,11885,12140,12764,11886,11887,11888,11889,11890,11891,11892,11893,11894,11895,11896,11897,11898,11899,11900,11901,11902,11903,11904,11905,11906,11907,11908,11909,11910,11911,11912,11913,12747,11914,11915,11916,11917,11918,11919,11920,11921,11922,11923,11924,11925,11926,11927,11928,11929,11930,11931,11932,11933,11934,11935,11936,11937,11938,11939,11940,11941,11942,11943,11944,11945,11946,11947,11948,11950,11951,11952,11953,11954,11955,11956,11957,11958,11959,11960,11961,11962,11963,11964,11965,11966,11967,11968,11969,11970,11971,11972,11973,11974,11975,11976,11977,11978,11979,11980,11981,11982,11983,11984,11985,11986,11987,11988,3267,3268,3269,3270,3271,3272,3273,3274,3275,3276,3277,3278,3279,3280,3281,3282,3283,3284,3556,3285,3286,3287,3288,3289,3290,3291,3292,3293,6043,8937,8941,5964,237,212,6003,5976,12556,12549,9925,12711,12722,620,12729,614,12720,2858,216,12583,9823,9801,9803,6076,3002,3294,3295,3296,3297,3553,3555,3557,3558,3559,3560,3561,3562,3563,3564,3565,3566,3567,3575,3576,3577,3578,3579,3580,3581,3582,3583,3584,3585,3586,4422,4423,4424,4425,4426,4427,4428,4429,4431,4432,4430,4433,4434,4435,4436,4437,4438,4439,4440,4441,4442,4443,4444,4445,4446,4447,4448,4449,4450,4451,4452,4453,4454,4455,4567,4568,4569,4756,4757,4758,4759,12765,596,12766,592,593,594,597,12767,12708,604,12737,12744,12756,606,607,608,12754,12752,12736,609,611,610,612,12753,615,713,616,12710,618,617,619,12738,1665,12662,12727,12748,12698,12697,12749,12670,12762,12719,622,12686,613,12728,2824,624,12696,595,625,12739,12682,12679,12733,12683,12751,12684,12627,12685,621,12761,12721,12687,12689,12692,12769,12760,12694,297,12742,12768,12690,12691,12741,12771,12702,12731,2020,12746,12693,12695,12707,12699,590,591,12700,603,588,12715,12701,12704,12745,602,12703,12705,12709,12713,12724,12750,12755,12714,12717,12718,12770,623,12757,12723,12763,12725,589,12726,12712,12743,587,12716,605,12730,12735,12759,12740,261,165,179,153,151,233,230,228,198,181,251,204,202,115,191,173,247,135,245,171,169,133,125,253,200,129,131,112,214,127,220,265,235,12781,239,241,206,119,155,157,267,218,143,255,161,163,102,139,257,167,118,189,196,121,123,222,141,208,210,177,3568,243,226,259,149,147,145,224,269,137,113,249,107,193,263,183,185,187,271,12482,12484,12570,12478,12598,12434,12431,12425,12792,12524,12604,12568,12569,12567,12545,12520,12600,12502,12513,12461,12507,12477,12550,12536,12544,12518,12517,12796,12773,12790,12599,12525,12577,12595,12508,12597,12462,12582,12465,12466,12437,12547,12601,12794,12445,12439,12438,12596,12543,12537,12563,12603,12534,12564,12491,12492,12800,12602,12468,12467,12422,12519,12561,12460}function onUse(cid, item, frompos, item2, topos) if getItemAttribute(item.uid, "corpseowner") ~= cid then doPlayerSendCancel(cid, "You're not the owner.") return true end local items = {} for x=0, (getContainerSize(item.uid)) do local itens = getContainerItem(item.uid, X) --if isInArray(toloot, itens.itemid) then table.insert(items, {i=itens.itemid, q=itens.type}) doRemoveItem(itens.uid) --break --end 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 if #items > 0 then return true else return false endendou como não está usando a tabela poderá deixar assim
function onUse(cid, item, frompos, item2, topos) if getItemAttribute(item.uid, "corpseowner") ~= cid then doPlayerSendCancel(cid, "You're not the owner.") return true end local items = {} for x=0, (getContainerSize(item.uid)) do local itens = getContainerItem(item.uid, X) table.insert(items, {i=itens.itemid, q=itens.type}) doRemoveItem(itens.uid) 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 if #items > 0 then return true else return false endend
Perfeito pego aquele bug saio porem apareceu outro se consegui me ajuda com este que apareceu agora RS ^^
BUG
[17/12/2016 03:52:26] [Error - Action Interface]
[17/12/2016 03:52:26] data/actions/scripts/autoloot.lua:onUse
[17/12/2016 03:52:26] Description:
[17/12/2016 03:52:26] (luaDoPlayerAddItem) Item not found
[17/12/2016 03:52:26] [Error - Action Interface]
[17/12/2016 03:52:26] data/actions/scripts/autoloot.lua:onUse
[17/12/2016 03:52:26] Description:
[17/12/2016 03:52:26] data/lib/050-function.lua:227: attempt to index a boolean value
[17/12/2016 03:52:26] stack traceback:
[17/12/2016 03:52:26] data/lib/050-function.lua:227: in function 'getItemNameById'
[17/12/2016 03:52:26] data/actions/scripts/autoloot.lua:14: in function <data/actions/scripts/autoloot.lua:1>
Up =/
info
Grupo: Visconde
Registrado: 20/03/14
Posts: 367
Reputação: +219
Gênero: Masculino

Em 17/12/2016 at 18:06, brunoo1996 disse:Perfeito pego aquele bug saio porem apareceu outro se consegui me ajuda com este que apareceu agora RS ^^
BUG
[17/12/2016 03:52:26] [Error - Action Interface]
[17/12/2016 03:52:26] data/actions/scripts/autoloot.lua:onUse
[17/12/2016 03:52:26] Description:
[17/12/2016 03:52:26] (luaDoPlayerAddItem) Item not found
[17/12/2016 03:52:26] [Error - Action Interface]
[17/12/2016 03:52:26] data/actions/scripts/autoloot.lua:onUse
[17/12/2016 03:52:26] Description:
[17/12/2016 03:52:26] data/lib/050-function.lua:227: attempt to index a boolean value
[17/12/2016 03:52:26] stack traceback:
[17/12/2016 03:52:26] data/lib/050-function.lua:227: in function 'getItemNameById'
[17/12/2016 03:52:26] data/actions/scripts/autoloot.lua:14: in function <data/actions/scripts/autoloot.lua:1>
Up =/
Desculpe a demora em responder.. não tive tempo esse final de semana.
Refiz o código testa aew e me manda um feedback
function onUse(cid, item, frompos, item2, topos) if getItemAttribute(item.uid, "corpseowner") ~= cid then doPlayerSendCancel(cid, "You're not the owner.") return true end local removeItems = {} for x = 0, getContainerSize(item.uid) do local items = getContainerItem(item.uid, x) if items.uid > 0 then if doPlayerAddItemStacking(cid, items.itemid, items.type) ~= false then table.insert(removeItems, items.uid) end end end if #removeItems > 0 then for i = 1, #removeItems do doChangeTypeItem(removeItems[i], 0) end endend
info
Grupo: Infante
Registrado: 27/08/11
Posts: 1.9k
Reputação: +85
Gênero: Masculino
Char no Tibia: Bruno Maciel

Perfeito cara agora sim sem erro tudo certinho!!
Valeu irmao ![]()
Rep++
info
Grupo: Herói
Registrado: 07/03/16
Posts: 1.4k
Reputação: +385
Gênero: Masculino

Caro membro, seu tópico foi movido de Otserv > Suporte Otserv para Suporte Otserv > Otserv > Pedidos e Dúvidas Resolvidos.




info
Grupo: Infante
Registrado: 27/08/11
Posts: 1.9k
Reputação: +85
Gênero: Masculino
Char no Tibia: Bruno Maciel
O bug que eu estava tendo problemas sobre o auto loot o Drakopoulos conseguil me ajuda porem esta dando um outro bug agora.
Preciso muito de ajuda quem puder me ajuda
BUG
[17/12/2016 03:52:26] [Error - Action Interface]
[17/12/2016 03:52:26] data/actions/scripts/autoloot.lua:onUse
[17/12/2016 03:52:26] Description:
[17/12/2016 03:52:26] (luaDoPlayerAddItem) Item not found
[17/12/2016 03:52:26] [Error - Action Interface]
[17/12/2016 03:52:26] data/actions/scripts/autoloot.lua:onUse
[17/12/2016 03:52:26] Description:
[17/12/2016 03:52:26] data/lib/050-function.lua:227: attempt to index a boolean value
[17/12/2016 03:52:26] stack traceback:
[17/12/2016 03:52:26] data/lib/050-function.lua:227: in function 'getItemNameById'
[17/12/2016 03:52:26] data/actions/scripts/autoloot.lua:14: in function <data/actions/scripts/autoloot.lua:1
SCRIPT
function onUse(cid, item, frompos, item2, topos)
if getItemAttribute(item.uid, "corpseowner") ~= cid then
doPlayerSendCancel(cid, "You're not the owner.")
return true
end
local items = {}
for x=0, (getContainerSize(item.uid)) do
local itens = getContainerItem(item.uid,
table.insert(items, {i=itens.itemid, q=itens.type})
doRemoveItem(itens.uid)
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
if #items > 0 then
return true
else
return false
end
end
OBS: se precisar da parte da LIB so fala que eu posto
Rep+++
Editado Dezembro 17 por brunoo1996