Postado Junho 26, 2017 7 anos Bom pessoal, estou tentando resolver, usei outros script mais também não obtive sucesso nos planos, o mais completo é esse, e ele até entrega os items, mais logo depois buga, e parece este erro na distro: Alguem consegue arrumalo pra mim? Estou usando TFS 0.4. creaturescript/script/VocReward.lua: Spoiler local c = { [{1,5}] = { [13] = {items = {{itemid = 2191, count = 1}, {itemid = 2160, count = 1}}, storage = 40953}, [19] = {items = {{itemid = 2188, count = 1}, {itemid = 2160, count = 2}}, storage = 40954} }, [{2,6}] = { [13] = {items = {{itemid = 2186, count = 1}}, storage = 40953}, [19] = {items = {{itemid = 2185, count = 1}}, storage = 40954}, [22] = {items = {{itemid = 8911, count = 1}}, storage = 40955}, [26] = {items = {{itemid = 2181, count = 1}}, storage = 40956}, [33] = {items = {{itemid = 2183, count = 1}, {itemid = 2152, count = 25}}, storage = 40957}, [37] = {items = {{itemid = 8912, count = 1}, {itemid = 2152, count = 50}}, storage = 40958}, [42] = {items = {{itemid = 8910, count = 1}, {itemid = 2160, count = 1}}, storage = 40959} }, [{3,7}] = { [12] = {items = {{itemid = 2389, count = 5}}, storage = 40953}, [16] = {items = {{itemid = 2389, count = 10}}, storage = 40954}, [20] = {items = {{itemid = 3965, count = 10}}, storage = 40955}, [25] = {items = {{itemid = 7378, count = 10}}, storage = 40956}, [30] = {items = {{itemid = 2456, count = 1}, {itemid = 2544, count = 100}}, storage = 40957}, [35] = {items = {{itemid = 7364, count = 100}, {itemid = 2152, count = 75}}, storage = 40958}, [40] = {items = {{itemid = 7365, count = 100}, {itemid = 2160, count = 1}}, storage = 40959} }, [{4,8}] = { [15] = {items = {{itemid = 2409, count = 1}}, storage = 40953}, [30] = {items = {{itemid = 2392, count = 1}, {itemid = 2152, count = 75}}, storage = 40957}, [40] = {items = {{itemid = 2407, count = 1}, {itemid = 2160, count = 1}}, storage = 40959} } } function onAdvance(cid, skill, oldlevel, newlevel) if skill ~= SKILL__LEVEL then return true end for voc, x in pairs(c) do if isInArray(voc, getPlayerVocation(cid)) then for level, z in pairs(x) do if newlevel >= level and getPlayerStorageValue(cid, z.storage) ~= 1 then local text = "" for v = 1, #z.items do count, info = z.items[v].count, getItemInfo(z.items[v].itemid) local ret = ", " if v == 1 then ret = "" elseif v == #z.items then ret = " and " end text = text .. ret text = text .. (count > 1 and count or info.article).." "..(count > 1 and info.plural or info.name) doPlayerAddItem(cid, z.items[v].itemid, z.items[v].count) end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabens, voce alcancou o level "..level.." e obteve "..text..".") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW) setPlayerStorageValue(cid, z.storage, 1) end end end end return true end creaturescript/script/login.lua: Spoiler registerCreatureEvent(cid, "VocReward") creaturescript/creaturescript.xml: Spoiler <event type="advance" name="VocReward" event="script" value="Item Por Level/VocReward.lua"/> Rep+, obrigado!
Postado Junho 26, 2017 7 anos @Digoshow não tem diferença, apenas um pouco identado: Spoiler local c = { [{1,5}] = { [421] = {items = {{itemid = 2160, count = 1}, {itemid = 2160, count = 2}}, storage = 40953}, [424] = {items = {{itemid = 2160, count = 1}, {itemid = 2160, count = 2}}, storage = 40954}, [426] = {items = {{itemid = 2148, count = 1}, {itemid = 2148, count = 2}}, storage = 40955} }, [{2,6}] = { [13] = {items = {{itemid = 2186, count = 1}}, storage = 40953}, [19] = {items = {{itemid = 2185, count = 1}}, storage = 40954}, [22] = {items = {{itemid = 8911, count = 1}}, storage = 40955}, [26] = {items = {{itemid = 2181, count = 1}}, storage = 40956}, [33] = {items = {{itemid = 2183, count = 1}, {itemid = 2152, count = 25}}, storage = 40957}, [37] = {items = {{itemid = 8912, count = 1}, {itemid = 2152, count = 50}}, storage = 40958}, [42] = {items = {{itemid = 8910, count = 1}, {itemid = 2160, count = 1}}, storage = 40959} }, [{3,7}] = { [12] = {items = {{itemid = 2389, count = 5}}, storage = 40953}, [16] = {items = {{itemid = 2389, count = 10}}, storage = 40954}, [20] = {items = {{itemid = 3965, count = 10}}, storage = 40955}, [25] = {items = {{itemid = 7378, count = 10}}, storage = 40956}, [30] = {items = {{itemid = 2456, count = 1}, {itemid = 2544, count = 100}}, storage = 40957}, [35] = {items = {{itemid = 7364, count = 100}, {itemid = 2152, count = 75}}, storage = 40958}, [40] = {items = {{itemid = 7365, count = 100}, {itemid = 2160, count = 1}}, storage = 40959} }, [{4,8}] = { [15] = {items = {{itemid = 2409, count = 1}}, storage = 40953}, [30] = {items = {{itemid = 2392, count = 1}, {itemid = 2152, count = 75}}, storage = 40957}, [40] = {items = {{itemid = 2407, count = 1}, {itemid = 2160, count = 1}}, storage = 40959} } } function onAdvance(cid, skill, oldlevel, newlevel) if skill ~= SKILL__LEVEL then return true end for voc, x in pairs(c) do if isInArray(voc, getPlayerVocation(cid)) then for level, z in pairs(x) do if newlevel >= level and getPlayerStorageValue(cid, z.storage) ~= 1 then local text = "" for v = 1, #z.items do count, info = z.items[v].count, getItemInfo(z.items[v].itemid) local ret = ", " if v == 1 then ret = "" elseif v == #z.items then ret = " and " end text = text .. ret text = text .. (count > 1 and count or info.article).." "..(count > 1 and info.plural or info.name) doPlayerAddItem(cid, z.items[v].itemid, z.items[v].count) end setPlayerStorageValue(cid, z.storage, 1) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabens, voce alcancou o level "..level.." e obteve "..text..".") end end end end return true end Testei aqui, e o scripts está funcionando como deveria, o erro no console é devido a outro script, mais precisamente no callback onKill, dando erro nesse callback, retorna erro na morte do monstro/player, no caso do monstro, as vezes pode não retorna o exp. O erro do script da print está interferindo no funcionamento do script acima. O erro da print vem de algum mod, desabilite ou conserte, e teste!
Postado Junho 27, 2017 7 anos Autor 5 horas atrás, KotZletY disse: @Digoshow não tem diferença, apenas um pouco identado: Ocultar conteúdo local c = { [{1,5}] = { [421] = {items = {{itemid = 2160, count = 1}, {itemid = 2160, count = 2}}, storage = 40953}, [424] = {items = {{itemid = 2160, count = 1}, {itemid = 2160, count = 2}}, storage = 40954}, [426] = {items = {{itemid = 2148, count = 1}, {itemid = 2148, count = 2}}, storage = 40955} }, [{2,6}] = { [13] = {items = {{itemid = 2186, count = 1}}, storage = 40953}, [19] = {items = {{itemid = 2185, count = 1}}, storage = 40954}, [22] = {items = {{itemid = 8911, count = 1}}, storage = 40955}, [26] = {items = {{itemid = 2181, count = 1}}, storage = 40956}, [33] = {items = {{itemid = 2183, count = 1}, {itemid = 2152, count = 25}}, storage = 40957}, [37] = {items = {{itemid = 8912, count = 1}, {itemid = 2152, count = 50}}, storage = 40958}, [42] = {items = {{itemid = 8910, count = 1}, {itemid = 2160, count = 1}}, storage = 40959} }, [{3,7}] = { [12] = {items = {{itemid = 2389, count = 5}}, storage = 40953}, [16] = {items = {{itemid = 2389, count = 10}}, storage = 40954}, [20] = {items = {{itemid = 3965, count = 10}}, storage = 40955}, [25] = {items = {{itemid = 7378, count = 10}}, storage = 40956}, [30] = {items = {{itemid = 2456, count = 1}, {itemid = 2544, count = 100}}, storage = 40957}, [35] = {items = {{itemid = 7364, count = 100}, {itemid = 2152, count = 75}}, storage = 40958}, [40] = {items = {{itemid = 7365, count = 100}, {itemid = 2160, count = 1}}, storage = 40959} }, [{4,8}] = { [15] = {items = {{itemid = 2409, count = 1}}, storage = 40953}, [30] = {items = {{itemid = 2392, count = 1}, {itemid = 2152, count = 75}}, storage = 40957}, [40] = {items = {{itemid = 2407, count = 1}, {itemid = 2160, count = 1}}, storage = 40959} } } function onAdvance(cid, skill, oldlevel, newlevel) if skill ~= SKILL__LEVEL then return true end for voc, x in pairs(c) do if isInArray(voc, getPlayerVocation(cid)) then for level, z in pairs(x) do if newlevel >= level and getPlayerStorageValue(cid, z.storage) ~= 1 then local text = "" for v = 1, #z.items do count, info = z.items[v].count, getItemInfo(z.items[v].itemid) local ret = ", " if v == 1 then ret = "" elseif v == #z.items then ret = " and " end text = text .. ret text = text .. (count > 1 and count or info.article).." "..(count > 1 and info.plural or info.name) doPlayerAddItem(cid, z.items[v].itemid, z.items[v].count) end setPlayerStorageValue(cid, z.storage, 1) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabens, voce alcancou o level "..level.." e obteve "..text..".") end end end end return true end Testei aqui, e o scripts está funcionando como deveria, o erro no console é devido a outro script, mais precisamente no callback onKill, dando erro nesse callback, retorna erro na morte do monstro/player, no caso do monstro, as vezes pode não retorna o exp. O erro do script da print está interferindo no funcionamento do script acima. O erro da print vem de algum mod, desabilite ou conserte, e teste! Sim, este erro acontece quando eu mato uma criatura, ela fica sem life mais não morre, tipo não muda pra corpse, e o erro aparece na Distro, os unicos mods que tenho é firstitems e autoloot: firstitems: Spoiler <?xml version="1.0" encoding="UTF-8"?> <mod name="First Items" version="1.0" author="The Forgotten Server" contact="otland.net" enabled="yes"> <config name="firstitems_config"><![CDATA[ config = { storage = 30001, items = {2050} } ]]></config> <event type="login" name="FirstItems" event="script"> <![CDATA[ domodlib('firstitems_config') function onLogin(cid) local config = { voc_items = { { -- SORC {2190}, -- wand of vortex {2175}, -- spellbook {8820}, -- mage hat {8819}, -- mage robe {2468} -- studded legs }, { -- DRUID {2182}, -- snakebite rod {2175}, -- spellbook {8820}, -- mage hat {8819}, -- mage robe {2468} -- studded legs }, { -- PALADIN {2389, 5}, -- Spear {2456}, -- Bow {2544, 100}, -- Arrow {2480}, -- legion helmet {2660}, -- Ranger's Cloak {8923} -- Ranger Legs }, { -- KNIGHT {8602}, -- jagged sword {8601}, -- steel axe {8602}, -- jagged sword {2509}, -- steel shield {2481}, -- soldier helmet {2478}, -- brass legs {2465} -- brass armor } }, all_items = { {2661}, -- scarf {2643} -- leather boots }, extra_items = { {2789, 15}, {2120}, {7620, 1}, {7618, 1}, {5710} }, knight_weapons = { {2423}, -- clerical mace {2429} -- barbarian axe } } if getPlayerGroupId(cid) < 3 then if getPlayerStorageValue(cid, storage) == -1 then local common = config.voc_items[getPlayerVocation(cid)] if common ~= nil then for _, v in ipairs(common) do doPlayerAddItem(cid, v[1], v[2] or 1) end end local all = config.all_items if all ~= nil then for _, v in ipairs(all) do doPlayerAddItem(cid, v[1], v[2] or 1) end end local extra = config.extra_items local bp = doPlayerAddItem(cid, 1988, 1) if extra ~= nil then for _, v in ipairs(extra) do doAddContainerItem(bp, v[1], v[2] or 1) end end local weapons = config.knight_weapons if weapons ~= nil then for _, w in ipairs(weapons) do if isKnight(cid) then doAddContainerItem(bp, w[1], w[2] or 1) end end end setPlayerStorageValue(cid, storage, 1) end end return true end ]]></event> </mod> Auto Loot: Spoiler <?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes"> <config name="Loot_func"><![CDATA[ info = { AutomaticDeposit = true, BlockMonsters = {'Bazir', 'Annihilon', 'Zugurosh', 'Ushuriel', 'Orshabaal', 'Morgaroth', 'Leviathan', 'Ghazbaran', 'Ferumbras'}, BlockItemsList = {}, Max_Slots = {free = 1, premium = 3}, Storages = {27000,28001,28002} } function setPlayerStorageTable(cid, storage, tab) local tabstr = "&" for i,x in pairs(tab) do tabstr = tabstr .. i .. "," .. x .. ";" end setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1)) end function getPlayerStorageTable(cid, storage) local tabstr = getPlayerStorageValue(cid, storage) local tab = {} if type(tabstr) ~= "string" then return {} end if tabstr:sub(1,1) ~= "&" then return {} end local tabstr = tabstr:sub(2, #tabstr) local a = string.explode(tabstr, ";") for i,x in pairs(a) do local b = string.explode(x, ",") tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2] end return tab end function isInTable(cid, item) for _,i in pairs(getPlayerStorageTable(cid, info.Storages[1]))do if tonumber(i) == tonumber(item) then return true end end return false end function addItemTable(cid, item) local x = {} for i = 1,#getPlayerStorageTable(cid, info.Storages[1]) do table.insert(x,getPlayerStorageTable(cid, info.Storages[1])) end if x ~= 0 then table.insert(x,tonumber(item)) setPlayerStorageTable(cid, info.Storages[1], x) else setPlayerStorageTable(cid, info.Storages[1], {item}) end end function removeItemTable(cid, item) local x = {} for i = 1,#getPlayerStorageTable(cid, info.Storages[1]) do table.insert(x,getPlayerStorageTable(cid, info.Storages[1])) end for i,v in ipairs(x) do if tonumber(v) == tonumber(item) then table.remove(x,i) end end return setPlayerStorageTable(cid, info.Storages[1], x) end function ShowItemsTabble(cid) local n,str = 0,"[+] Auto Loot Comandos [+]\n\n!autoloot item name --> Para adicionar ou Remover item da lista.\n!autoloot gold --> Para coletar golds automaticamente.\n!autoloot clear --> Para limpar a lista.\n!autoloot on/off --> Para ativar ou desativar a coleta de itens no sistema, se não usar o sistema deixe desativado!\n\n[+] Auto Loot Info [+]\n\nSystem: "..(getPlayerStorageValue(cid, info.Storages[3]) <= 0 and "Activated" or "Disabled")..".\nGold Collecting: "..(getPlayerStorageValue(cid, info.Storages[2]) > 0 and "Activated" or "Disabled")..".\nBalance Total: ["..getPlayerBalance(cid).."] gp's.\nMaximum Slots: ["..#getPlayerStorageTable(cid, info.Storages[1]).."/"..(isPremium(cid) and info.Max_Slots.premium or info.Max_Slots.free).."]\n\n[+] Auto Loot Slots [+]\n\n" for i = 1,#getPlayerStorageTable(cid, info.Storages[1]) do n = n + 1 str = str.."Slot "..n.." - "..getItemNameById(getPlayerStorageTable(cid, info.Storages[1])).."\n" end return doPlayerPopupFYI(cid, str) end function getContainerItems(containeruid) local items = {} local containers = {} if type(getContainerSize(containeruid)) ~= "number" then return false end for slot = 0, getContainerSize(containeruid)-1 do local item = getContainerItem(containeruid, slot) if item.itemid == 0 then break end if isContainer(item.uid) then table.insert(containers, item.uid) end table.insert(items, item) end if #containers > 0 then for i,x in ipairs(getContainerItems(containers[1])) do table.insert(items, x) end table.remove(containers, 1) end return items end function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function doPlayerAddItemStacking(cid, itemid, amount) -- revisado local item, _G = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid), 0 if #item > 0 then for _ ,x in pairs(item) do local ret = getThing(x) if ret.type < 100 then doTransformItem(ret.uid, itemid, ret.type+amount) if ret.type+amount > 100 then doPlayerAddItem(cid, itemid, ret.type+amount-100) end break else _G = _G+1 end end if _G == #item then doPlayerAddItem(cid, itemid, amount) end else return doPlayerAddItem(cid, itemid, amount) end end function AutomaticDeposit(cid,item,n) local deposit = item == tonumber(9971) and (n*1000000) or tonumber(item) == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1) return doPlayerDepositMoney(cid, deposit) end function corpseRetireItems(cid, pos) local check = false for i = 0, 255 do pos.stackpos = i tile = getTileThingByPos(pos) if tile.uid > 0 and isCorpse(tile.uid) then check = true break end end if check == true then local items = getContainerItems(tile.uid) for i,x in pairs(items) do if isInArray(getPlayerStorageTable(cid, info.Storages[1]), tonumber(x.itemid)) or getPlayerStorageValue(cid, info.Storages[2]) > 0 and isInArray({2148,2152,2160,9971},tonumber(x.itemid)) then if isItemStackable(x.itemid) then doPlayerAddItemStacking(cid, x.itemid, x.type) if info.AutomaticDeposit == true and isInArray({2148,2152,2160,9971}, tonumber(x.itemid)) then AutomaticDeposit(cid,x.itemid,x.type) end else doPlayerAddItem(cid, x.itemid) end doRemoveItem(x.uid) end end end end ]]></config> <event type="login" name="LootLogin" event="script"><![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "LootEventKIll") if isPremium(cid) and getPlayerStorageValue(cid, 27001) <= 0 then setPlayerStorageValue(cid, 27001, 1) elseif getPlayerStorageValue(cid, 27001) > 0 and not isPremium(cid) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Auto Loot] You premium is Over, Start a new list!") setPlayerStorageValue(cid, 27001, -1) setPlayerStorageValue(cid, info.Storages[1], -1) end return true end]]></event> <event type="kill" name="LootEventKIll" event="script"><![CDATA[ domodlib('Loot_func') function onKill(cid, target, lastHit) if isPlayer(cid) and getPlayerStorageValue(cid, info.Storages[3]) <= 0 and isMonster(target) and not isInArray(info.BlockMonsters, getCreatureName(target):lower()) then addEvent(corpseRetireItems, 0, cid ,getThingPos(target)) end return true end]]></event> <talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[ domodlib('Loot_func') local param, slots = param:lower(), isPremium(cid) and info.Max_Slots.premium or info.Max_Slots.free if not param or param == "" then ShowItemsTabble(cid) return true elseif tonumber(param) then doPlayerSendCancel(cid, "enter commands: !autoloot item name [+] !autoloot clean [+] !autoloot gold [+] !autoloot on/off") return true elseif isInArray({"clean","limpar", "clear"}, param) then setPlayerStorageValue(cid, info.Storages[1], -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Auto Loot] Your list has been cleaned.") return true elseif isInArray({"start","stop","on","off"}, param) then setPlayerStorageValue(cid, info.Storages[3], getPlayerStorageValue(cid, info.Storages[3]) <= 0 and 1 or 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Auto Loot] "..(getPlayerStorageValue(cid, info.Storages[3]) > 0 and "Stopped" or "Started")..".") return true elseif isInArray({"money","gold","gps","dinheiro"}, param) then setPlayerStorageValue(cid, info.Storages[2], getPlayerStorageValue(cid, info.Storages[2]) <= 0 and 1 or 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Auto Loot] Gold Colleting "..(getPlayerStorageValue(cid, info.Storages[2]) > 0 and "Activated" or "disabled")..".") return true end local item = getItemIdByName(param, false) if not item then doPlayerSendCancel(cid, "This item does not exist.") return true end local var = isInTable(cid, item) if isInArray({2148,2152,2160,9971},item) then doPlayerSendCancel(cid, "Enter !autoloot gold to add gold in your list!") return true elseif isInArray(info.BlockItemsList, item) then doPlayerSendCancel(cid, "You can not add this item in the list!") return true elseif not var and #getPlayerStorageTable(cid, info.Storages[1]) >= slots then doPlayerSendCancel(cid, "Você ja atingiu o limite de "..slots.." slots, You have already reached the limit of "..slots.." slots") return true end if not var then addItemTable(cid, item) else removeItemTable(cid, item) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,not var and "you added the item "..param.." in the list" or "you removed the item "..param.." from the list") return true]]></talkaction> </mod> Ta ae as scripts, eu acho que se for alguma dessa, vai ser mais provavel que seja o autoloot, vou fazer o testes aqui enquanto isso, por enquanto obrigado!
Postado Junho 28, 2017 7 anos Autor Bom, realemte o problema era com o mod Autoloot, testei sem e o script de dar o Item por Level e Vocação também funcionou perfeitamente, então troquei o script MODs do Autoloot por um outro Creaturescript, porem continua aparecendo este erro de onKill quando eu ligo o comando !autoloot gold ou adiciono algum item pelo comando do autoloot, de uma conferida na distro: data/creaturescripts/scripts/Autoloot/Auto Loot.lua: Spoiler -- Sistema de auto loot por Paulo Victor xZonaah TK -- local tabela = {} local function getPlayerList(cid) local tab = {} if getPlayerStorageValue(cid, 0442002) ~= -1 then table.insert(tab, getPlayerStorageValue(cid, 0442002)) end if getPlayerStorageValue(cid, 0442003) ~= -1 then table.insert(tab, getPlayerStorageValue(cid, 0442003)) end if getPlayerStorageValue(cid, 0442004) ~= -1 then table.insert(tab, getPlayerStorageValue(cid, 0442004)) end if getPlayerStorageValue(cid, 0442005) ~= -1 then table.insert(tab, getPlayerStorageValue(cid, 0442005)) end if #tab > 0 then return tab end return false end local function autoLoot(cid, pos) local check = false local str = "" local position = {} for i = 1, 255 do pos.stackpos = i if getThingFromPos(pos).uid and getThingFromPos(pos).uid > 0 and isContainer(getThingFromPos(pos).uid) then position = pos check = true break end end if check then local corpse = getContainerItemsInfo(getThingFromPos(position).uid) if corpse then for index, info in pairs(corpse) do if index < countTable(corpse) then if tonumber(info.uid) and tonumber(info.itemid) then if isContainer(info.uid) then local bag = getContainerItemsInfo(info.uid) for i = 1, countTable(bag) - 1 do if isInArray(getPlayerList(cid), bag.itemid) then if bag.quant > 1 then doRemoveItem(bag.uid, bag.quant) doPlayerAddItem(cid, bag.itemid, bag.quant) str = str.." "..bag.quant.." "..getItemNameById(bag.itemid).."," else doRemoveItem(bag.uid) doPlayerAddItem(cid, bag.itemid, 1) str = str.." 1 "..getItemNameById(bag.itemid).."," end end end end end end if isInArray(getPlayerList(cid), info.itemid) then if info.quant > 1 then doRemoveItem(info.uid, info.quant) doPlayerAddItem(cid, info.itemid, info.quant) str = str.." "..info.quant.." "..getItemNameById(info.itemid).."," else doRemoveItem(info.uid) doPlayerAddItem(cid, info.itemid, 1) str = str.." 1 "..getItemNameById(info.itemid).."," end end end end end tabela[getCreatureName(cid)] = {item = "[Zona Loot] Coletados: "..str, gold = 0} end local function autoGold(cid, pos) local check = false local total = 0 local position = {} for i = 1, 255 do pos.stackpos = i if getThingFromPos(pos).uid and getThingFromPos(pos).uid > 0 and isContainer(getThingFromPos(pos).uid) then position = pos check = true break end end if check then local corpse = getContainerItemsInfo(getThingFromPos(position).uid) if corpse then for index, info in pairs(corpse) do if info.uid and info.itemid then if index < countTable(corpse) then if isContainer(info.uid) then local bag = getContainerItemsInfo(info.uid) for i = 1, countTable(bag) - 1 do if isInArray({2148, 2152, 2160}, bag.itemid) then local multiplie = 1 if bag.itemid == 2148 then multiplie = 1 elseif bag.itemid == 2152 then multiplie = 100 elseif bag.itemid == 2160 then multiplie = 10000 end doRemoveItem(bag.uid, bag.quant) doPlayerSetBalance(cid, getPlayerBalance(cid) + (tonumber(bag.quant) and tonumber(bag.quant) * multiplie or 0)) total = total + (tonumber(bag.quant) and tonumber(bag.quant) * multiplie or 0) doPlayerSetStorageValue(cid, 0442102, getPlayerStorageZero(cid, 0442102) + (tonumber(bag.quant) and tonumber(bag.quant) * multiplie or 0)) end end end end if isInArray({2148, 2152, 2160}, info.itemid) then local multiplie = 1 if info.itemid == 2148 then multiplie = 1 elseif info.itemid == 2152 then multiplie = 100 elseif info.itemid == 2160 then multiplie = 10000 end doRemoveItem(info.uid, info.quant) doPlayerSetBalance(cid, getPlayerBalance(cid) + (tonumber(info.quant) and tonumber(info.quant) * tonumber(multiplie) or 0)) doPlayerSetStorageValue(cid, 0442102, getPlayerStorageZero(cid, 0442102) + (tonumber(info.quant) and tonumber(info.quant) * tonumber(multiplie) or 0)) total = total + (tonumber(info.quant) and tonumber(info.quant) * multiplie or 0) end end end end end if tabela[getCreatureName(cid)] and tabela[getCreatureName(cid)].gold then tabela[getCreatureName(cid)].gold = total end end local function sendMsg(cid) if tabela[getCreatureName(cid)] and tabela[getCreatureName(cid)].gold then if tabela[getCreatureName(cid)].gold == 0 then doPlayerSendTextMessage(cid, 23, tabela[getCreatureName(cid)].item) else doPlayerSendTextMessage(cid, 23, tabela[getCreatureName(cid)].item.." "..tabela[getCreatureName(cid)].gold.." gold coins.") end tabela[getCreatureName(cid)] = nil end end function onKill(cid, target, lastHit) if isPlayer(cid) and isMonster(target) then if getPlayerStorageValue(cid, 0442100) == 1 and getPlayerList(cid) then local pos = getCreaturePosition(target) addEvent(autoLoot, 500, cid, pos) end if getPlayerStorageValue(cid, 0442101) == 1 then local pos = getCreaturePosition(target) addEvent(autoGold, 500, cid, pos) end if getPlayerStorageValue(cid, 0442100) == 1 or getPlayerStorageValue(cid, 0442101) == 1 then addEvent(sendMsg, 540, cid) end end return true end O que você me diz? Teria como resolver este problema mantendo o script de dar os items? Editado Junho 28, 2017 7 anos por Digoshow (veja o histórico de edições)
Postado Junho 29, 2017 7 anos Autor Continuo com problema, alguem sabe alguma solução para este problema? @UP
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.