Postado Setembro 9, 2020 4 anos Em 06/09/2020 em 06:40, Belmont disse: @Rogex Joyz Talvez esteja faltando fechar alguma coisa nos arquivos xml, tenta verificar se instalou tudo certo. @diarmaint Coloca esse arquivo na pasta data/lib e ver se resolve: killua's lib.lua @Augusto Talvez funcione nessa versão, o que está faltando são as funções serem instaladas, baixe esse arquivo e coloque-o na pasta data/lib e veja se resolve o problema: killua's lib.lua @saiddias Se for TFS acho que não vai funcionar, tenta verificar isso, se vai funcionar Tópico atualizado! Foi adicionado o arquivo para as Libs do script, tinha esquecido dela kk, sorry Tinha dado certo bro, eu tinha achado essas libs pela net, fui mexendo aqui e ali e funfou. Até adicionei algumas coisas a mais no autoloot kkkk Somente as msg que não aparecem, tanto quando coleta gold/loot, mas mesmo assim está funcionando normal. Ainda vou quebrar a cabeça pra ver se faço essas msg funcionar, mais do resto está OK! Valeu bro! # Regras Gerais - TibiaKing.com # Contato: [email protected]Não respondo dúvidas via MP.
Postado Setembro 9, 2020 4 anos Autor @Augusto Que bom que deu certo Meu Curso sobre Programação para OTServer Programando OTServer Peça o seu script! Entre agora mesmo no grupo Developing Conteúdos: Spoiler • Cidade [8.60] • Cave de Boss • Widget Gesior • Autoloot 100% • [Old Client] Como Hookar Dll • Configurando VPS Windowns • [Solução] Código Caracteres Especiais Discord: Belmont#7352 Não esqueça do REP+
Postado Fevereiro 22, 2021 4 anos Em 30/04/2020 em 16:14, Belmont disse: E ai pessoal, vi que muitas pessoas tem problemas em instalar, e achar um script de autoloot 100% funcional. Foi ai que decidi postar aqui para vocês, um script totalmente novo e que realmente funciona, pronto para usar e abusar dele kkk. Bom, vamos parar de lero lero e bora ao que interessa. Fixados: Dinheiro Duplicado; Coleta itens até mesmo dentro das bag dos monstros; Lembrando que esse script NÃO é de minha autoria, e que já existe no Tk, mas em tópicos diferentes. Como eu uso ele já vou deixar tudo certo para o uso do mesmo. 1° Passo - Dentro da pasta data/actions/scripts crie um arquivo chamado autoloot_boost.lua Ocultar conteúdo function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, 45000) >= os.time() then doPlayerSendCancel(cid,"Você já está com o BOOST ativado!") return true end if doRemoveItem(item.uid) then doPlayerSetStorageValue(cid, 45000, os.time() + 3600 * 24) doSendMagicEffect(getThingPos(cid),49) doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você ativou o Auto Loot BOOST por mais 24 horas. Durante esse tempo os itens coletados serão vendidos automaticamente e o dinheiro será depositado no seu banco.") else doPlayerSendCancel(cid,"ERROR! Please contact the admnistrator.") end return true end Em data/actions/actions.xml registre o script assim: <action itemid="ITEMID" event="script" value="autoloot_boost.lua"/> 2° Passo - Vá na pasta data/creaturescripts/script e crie dois arquivos, um chamado autoloot.lua e o outro fimautoloot.lua depois, adicione os seguintes códigos: autoloot.lua Ocultar conteúdo local aloot_boost = {[2406] = 36, [2537] = 4800, [2377] = 480, [2663] = 600, [2472] = 195000, [2398] = 36, [2475] = 7200, [2519] = 6500, [2497] = 10700, [2523] = 180000, [2494] = 325000, [2400] = 144000, [2491] = 6000, [2421] = 325000, [2646] = 260000, [2477] = 7200, [2413] = 84, [2656] = 18000, [2498] = 52000, [2647] = 600, [2534] = 32500, [7402] = 19500, [2466] = 26000, [2465] = 240, [2408] = 120000, [2518] = 1800, [2500] = 3000, [2376] = 30, [2470] = 91000, [2388] = 24, [2645] = 26000, [2434] = 2400, [2463] = 480, [2536] = 11700, [2387] = 240, [2396] = 4800, [2381] = 240, [2528] = 4800, [2409] = 1800, [2414] = 12000, [2427] = 9000, [2407] = 7200, [2458] = 42, [2383] = 960, [2392] = 3600, [2488] = 18000, [2525] = 120, [2423] = 240, [7382] = 13000, [2462] = 1300, [2520] = 39000, [2390] = 180000, [2417] = 72, [2436] = 1200, [5741] = 52000, [2378] = 120, [2487] = 24000, [2476] = 6500, [8891] = 36000, [2459] = 36, [2195] = 52000, [2391] = 7200, [2464] = 120, [8889] = 72000, [2432] = 13000, [2431] = 108000, [2492] = 52000, [2515] = 240, [2430] = 2400, [2393] = 13000, [7419] = 36000, [2522] = 130000, [2514] = 65000} local function getPlayerStorageZero(cid, storage) -- By Killua local sto = getPlayerStorageValue(cid, storage) if tonumber(sto) then return tonumber(sto) > tonumber(0) and tonumber(sto) or tonumber(0) end return tonumber(0) end local tabela = {} local function getPlayerList(cid) local tab = {} if getPlayerStorageValue(cid, 04420021) ~= -1 then table.insert(tab, getPlayerStorageValue(cid, 04420021)) end if getPlayerStorageValue(cid, 04420031) ~= -1 then table.insert(tab, getPlayerStorageValue(cid, 04420031)) end if getPlayerStorageValue(cid, 04420041) ~= -1 then table.insert(tab, getPlayerStorageValue(cid, 04420041)) end if getPlayerStorageValue(cid, 04420051) ~= -1 then table.insert(tab, getPlayerStorageValue(cid, 04420051)) end if #tab > 0 then return tab end return {} end local function boost(cid) return tonumber(getPlayerStorageValue(cid,45000)) >= os.time() end local function lootItemsFromContainer(cid, container) local description = "" if container then for index, info in pairs(container) do if isContainer(info.uid) then local childContainer = getContainerItemsInfo(info.uid) local childDescription = lootItemsFromContainer(cid, childContainer) description = description .. " " .. childDescription elseif isInArray(getPlayerList(cid), info.itemid) then if info.quant > 1 then doRemoveItem(info.uid, info.quant) doPlayerAddItem(cid, info.itemid, info.quant) description = description.." "..info.quant.." "..getItemNameById(info.itemid).." +" else doRemoveItem(info.uid) if boost(cid) then if aloot_boost[info.itemid] then doPlayerSetBalance(cid,getPlayerBalance(cid) + aloot_boost[info.itemid]) description = description.." 1 "..getItemNameById(info.itemid).." ("..aloot_boost[info.itemid].."gps no banco) +" else doPlayerAddItem(cid, info.itemid, 1) description = description.." 1 "..getItemNameById(info.itemid).." +" end else doPlayerAddItem(cid, info.itemid, 1) description = description.." 1 "..getItemNameById(info.itemid).." +" end end end end end return description end local function autoLoot(cid, pos) if not isPlayer(cid) then return end 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) str = lootItemsFromContainer(cid, corpse) end setPlayerTableStorage(cid,822564,{[1] = str, [2] = 0}) end local function lootGoldFromContainer(cid, container) local total = 0 if container then for index, info in pairs(container) do if isContainer(info.uid) then local childContainer = getContainerItemsInfo(info.uid) local childTotal = lootGoldFromContainer(cid, childContainer) total = total + childTotal elseif 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) + info.quant * multiplie) doPlayerSetStorageValue(cid, 04421021, tonumber(getPlayerStorageZero(cid, 04421021)) + tonumber(info.quant) * tonumber(multiplie)) total = total + info.quant * multiplie end end end return total end local function autoGold(cid, pos) if not isPlayer(cid) then return end 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) total = lootGoldFromContainer(cid, corpse) end if total > 0 then local tab = getPlayerTableStorage(cid,822564) tab[2] = total setPlayerTableStorage(cid,822564,tab) end end local function sendMsg(cid) if not isPlayer(cid) then return end local tab = getPlayerTableStorage(cid,822564) if countTable(tab) >= 1 then if tab[1] then if tab[2] and tab[2] > 0 then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "[Auto Loot System] Coletados: ".. tab[1] .." ".. tab[2] .." gold coins.") else if type(tab[1]) == "string" and string.len(tab[1]) > 1 then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "[Auto Loot System] Coletados: "..tab[1]) end end elseif not tab[1] then if tab[2] then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "[Auto Loot System] Coletados: "..tab[2].." gold coins.") end end end doPlayerSetStorageValue(cid,822564,-1) end function onKill(cid, target, lastHit) if isPlayer(cid) and isMonster(target) then if getPlayerStorageValue(cid, 04421001) == 1 and #getPlayerList(cid) > 0 then local pos = getCreaturePosition(target) addEvent(autoLoot, 500, cid, pos) end if getPlayerStorageValue(cid, 04421011) == 1 then local pos = getCreaturePosition(target) addEvent(autoGold, 540, cid, pos) end if getPlayerStorageValue(cid, 04421001) == 1 or getPlayerStorageValue(cid, 04421011) == 1 then addEvent(sendMsg, 560, cid) end end return true end fimautoloot.lua Mostrar conteúdo oculto function onLogin(cid) if not isPremium(cid) then local active_slots = getPlayerStorageValue(cid, 04420011) if active_slots >= 1 then for i = 1, active_slots do doPlayerSetStorageValue(cid, (04420031 + (i * 10)), -1) doPlayerSetStorageValue(cid, 04420011, active_slots - 1) end end end return true end Agora em data/creaturescripts/creaturescripts.xml você vai registrar esses scripts dessa forma: <event type="kill" name="autoloot" event="script" value="autoloot.lua"/> <event type="login" name="fimautoloot" event="script" value="fimautoloot.lua"/> Abra o arquivo login.lua localizado na mesma pasta e adicione este código abaixo de outro registerCreatureEvent registerCreatureEvent(cid, "autoloot") Depois de instalar tudo, vamos para a pasta data/talkactions/script nela você irá criar um arquivo chamado autoloot.lua e vai adicionar este código: Mostrar conteúdo oculto function ExistItemByName(name) -- by vodka local items = io.open("data/items/items.xml", "r"):read("*all") local get = items:match('name="' .. name ..'"') if get == nil or get == "" then return false end return true end local function getPlayerList(cid) local tab = {} if getPlayerStorageValue(cid, 04420021) ~= -1 then table.insert(tab, getPlayerStorageValue(cid, 04420021)) end if getPlayerStorageValue(cid, 04420031) ~= -1 then table.insert(tab, getPlayerStorageValue(cid, 04420031)) end if getPlayerStorageValue(cid, 04420041) ~= -1 then table.insert(tab, getPlayerStorageValue(cid, 04420041)) end if getPlayerStorageValue(cid, 04420051) ~= -1 then table.insert(tab, getPlayerStorageValue(cid, 04420051)) end if #tab > 0 then return tab end return false end local function addToList(cid, name) local itemid = getItemIdByName(name) if getPlayerList(cid) and isInArray(getPlayerList(cid), itemid) then return false end if getPlayerStorageValue(cid, 04420021) == -1 then return doPlayerSetStorageValue(cid, 04420021, itemid) elseif getPlayerStorageValue(cid, 04420031) == -1 then return doPlayerSetStorageValue(cid, 04420031, itemid) elseif getPlayerStorageValue(cid, 04420041) == -1 then return doPlayerSetStorageValue(cid, 04420041, itemid) elseif getPlayerStorageValue(cid, 04420051) == -1 then return doPlayerSetStorageValue(cid, 04420051, itemid) end end local function removeFromList(cid, name) local itemid = getItemIdByName(name) if getPlayerStorageValue(cid, 04420021) == itemid then return doPlayerSetStorageValue(cid, 04420021, -1) elseif getPlayerStorageValue(cid, 04420031) == itemid then return doPlayerSetStorageValue(cid, 04420031, -1) elseif getPlayerStorageValue(cid, 04420041) == itemid then return doPlayerSetStorageValue(cid, 04420041, -1) elseif getPlayerStorageValue(cid, 04420051) == itemid then return doPlayerSetStorageValue(cid, 04420051, -1) end return false end function onSay(cid, words, param) if param == "" then local fi = getPlayerStorageValue(cid, 04420021) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420021)) or "" local se = getPlayerStorageValue(cid, 04420031) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420031)) or "" local th = not isPremium(cid) and "Não disponível para free account" or getPlayerStorageValue(cid, 04420041) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420041)) or "" local fo = not isPremium(cid) and "Não disponível para free account" or getPlayerStorageValue(cid, 04420051) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420051)) or "" local stt = getPlayerStorageValue(cid, 04421011) == 1 and "sim" or "não" local str = getPlayerStorageValue(cid, 04421001) == 1 and "sim" or "não" doPlayerPopupFYI(cid, " <--- Informações Do Auto Loot --->\n{Auto-Loot} ---Coletar dinheiro, Ligado? ("..stt.."). Para ligar ou desligar, digite: !autoloot gold \n{Auto-Loot} ---Coletar itens, Ligado? ("..str.."). Para ligar ou desligar, digite: !autoloot power\n\n{Auto-Loot} --Configuração Dos Slots:\n{Auto-Loot} ---Slot 1: "..fi.."\n{Auto-Loot} ---Slot 2: "..se.."\n{Auto-Loot} ---Slot 3: "..th.."\n{Auto-Loot} ---Slot 4: "..fo.."\n\n{Auto-Loot} ---Para adicionar um novo item no autoloot, digite: !autoloot add, <nome do item>\n{Auto-Loot} ---Para retirar um item do autoloot, digite: !autoloot remove, <nome do item>\n{Auto-Loot} ---Para limpar todos os slots, digite: !autoloot clear\n{Auto-Loot} ---Para informações de quanto você já fez utilizando a coleta de dinheiro, use: !autoloot goldinfo\n\nSe seu autoloot bugar use !autoloot desbug.") return true end local t = string.explode(param, ",") if t[1] == "power" then local check = getPlayerStorageValue(cid, 04421001) == -1 and "ligou" or "desligou" doPlayerSetStorageValue(cid, 04421001, getPlayerStorageValue(cid, 04421001) == -1 and 1 or -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você "..check.." o auto loot.") elseif t[1] == "gold" then local check = getPlayerStorageValue(cid, 04421011) == -1 and "ligou" or "desligou" doPlayerSetStorageValue(cid, 04421011, getPlayerStorageValue(cid, 04421011) == -1 and 1 or -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você "..check.." a coleta de dinheiro.") doPlayerSetStorageValue(cid, 04421021, 0) elseif t[1] == "goldinfo" then local str = getPlayerStorageValue(cid, 04421011) == -1 and "O sistema de coleta de dinheiro está desligado" or "O sistema já coletou "..getPlayerStorageZero(cid, 04421021).." gold coins" doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, str) elseif t[1] == "add" then if ExistItemByName(t[2]) then local item = getItemIdByName(t[2]) if isInArray({2160, 2148, 2152, 2157, 9971}, item) then return doPlayerSendCancel(cid, "Você não pode adicionar moedas no autoloot. Para coletar dinheiro use !autoloot gold") end if isPremium(cid) then if getPlayerStorageValue(cid, 04420011) < 1 then if addToList(cid, t[2]) then doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) + 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." adicionado à sua lista do auto loot! Para ver sua lista diga !autoloot list") else doPlayerSendCancel(cid, t[2].." já está em sua lista!") end else doPlayerSendCancel(cid, "Sua lista já tem 3 itens! Você deve remover algum antes de adicionar outro.") end else if getPlayerStorageValue(cid, 04420011) < 1 then if addToList(cid, t[2]) then doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) + 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." adicionado à sua lista do auto loot! Para ver sua lista diga !autoloot") else doPlayerSendCancel(cid, t[2].." já está em sua lista!") end else doPlayerSendCancel(cid, "Sua lista já tem 2 itens! Você deve remover algum antes de adicionar outro.") end end else doPlayerSendCancel(cid, "Este item não existe!") end elseif t[1] == "remove" then if ExistItemByName(t[2]) then if removeFromList(cid, t[2]) then doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) - 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." removido da sua lista do auto loot!") else doPlayerSendCancel(cid, "Este item não está na sua lista!") end else doPlayerSendCancel(cid, "Este item não existe!") end elseif t[1] == "clear" then if getPlayerStorageValue(cid, 04420011) > -1 then doPlayerSetStorageValue(cid, 04420011, -1) doPlayerSetStorageValue(cid, 04420021, -1) doPlayerSetStorageValue(cid, 04420031, -1) doPlayerSetStorageValue(cid, 04420041, -1) doPlayerSetStorageValue(cid, 04420051, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Lista limpa!") else doPlayerSendCancel(cid, "Sua lista ja esta limpa!") end elseif t[1] == "desbug" or t[1] == "desbugar" then doPlayerSetStorageValue(cid, 04420011, -1) doPlayerSetStorageValue(cid, 04420021, -1) doPlayerSetStorageValue(cid, 04420031, -1) doPlayerSetStorageValue(cid, 04420041, -1) doPlayerSetStorageValue(cid, 04420051, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Desbugado!") elseif t[1] == "list" then local fi = getPlayerStorageValue(cid, 04420021) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420021)).."\n" or "" local se = getPlayerStorageValue(cid, 04420031) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420031)).."\n" or "" local th = getPlayerStorageValue(cid, 04420041) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420041)).."\n" or "" local fo = getPlayerStorageValue(cid, 04420051) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420051)).."\n" or "" doPlayerPopupFYI(cid, "O sistema auto loot está coletando:\n "..fi..""..se..""..th..""..fo) end if(not checkExhausted(cid, 6667, 5)) then return true end return true end Em data/talkactions/talkcations.xml resgistra o script assim: <talkaction words="!autoloot" event="script" value="autoloot.lua"/> Vá na pasta lib, e crie um arquivo chamado autoloot, e cole isso dentro: Ocultar conteúdo --[[ Auto Loot System by Danyel Varejão ]] AutoLoot = { Min_Level = 100, -- Level minimo pra utilizar o auto loot. Max_Slots = 5, -- Máximo de slots permitidos. Boost_Actived = true, -- Nao mexa daqui pra baixo caso nao entenda -- Storage_Boost = 45000, Storage_On_Items = 45001, Storage_On_Gold = 45002, Storages = { Count_Gold = 45003, Count_Items = 45004, Count_Table = 45005, Slots = {45006, 45007, 45008, 45009, 45010} -- Storage pra cada slot. } } AutoLoot_Boost = { -- [ID do item] = Valor, [2406] = 36, [2537] = 4800, [2377] = 480, [2663] = 600, [2472] = 240000, [2398] = 36, [2475] = 7200, [2519] = 6000, [2497] = 10800, [2523] = 180000, [2494] = 108000, [2400] = 144000, [2491] = 6000, [2421] = 108000, [2646] = 240000, [2477] = 7200, [2413] = 84, [2656] = 18000, [2498] = 48000, [2647] = 600, [2534] = 30000, [7402] = 24000, [2466] = 36000, [2465] = 240, [2408] = 120000, [2518] = 1800, [2500] = 3000, [2376] = 30, [2470] = 96000, [2388] = 24, [2645] = 48000, [2434] = 2400, [2463] = 480, [2536] = 9600, [2387] = 240, [2396] = 4800, [2381] = 240, [2528] = 4800, [2409] = 1800, [2414] = 12000, [2427] = 9000, [2407] = 7200, [2458] = 42, [2383] = 960, [2392] = 3600, [2488] = 18000, [2525] = 120, [2423] = 240, [2462] = 4800, [2520] = 48000, [2390] = 180000, [2417] = 72, [2436] = 1200, [5741] = 42000, [2378] = 120, [2487] = 24000, [2476] = 6000, [8891] = 36000, [2459] = 36, [2195] = 48000, [2391] = 7200, [2464] = 120, [8889] = 72000, [2432] = 12000, [2431] = 108000, [2492] = 72000, [2515] = 240, [2430] = 2400, [2393] = 12000, [7419] = 36000, [2522] = 120000, [2514] = 180000 } function AutoLoot.CountTable(table) local Count = 0 if type(table) == "table" then for index in pairs(table) do Count = Count + 1 end return Count end return false end function AutoLoot.getContainerItemsInfo(ContainerUID) local Table = {} if ContainerUID and ContainerUID > 0 then local Index = 0 for i = 0, getContainerSize(ContainerUID) - 1 do local item = getContainerItem(ContainerUID, i) Index = Index + 1 Table[Index] = {UID = item.uid, ItemID = item.itemid, Count = item.type} end return Table end return false end function AutoLoot.String(String) local Table = {} local x, old, last = 0, 0, 0 local first, second, final = 0, 0, 0 if type(String) ~= "string" then return Table end for i = 2, #String - 1 do if string.byte(String:sub(i,i)) == string.byte(':') then x, second, last = x + 1, i - 1, i + 2 for t = last, #String - 1 do if string.byte(String:sub(t,t)) == string.byte(',') then first = x == 1 and 2 or old old, final = t + 2, t - 1 local Index = String:sub(first, second) local Var = String:sub(last, final) Table[tonumber(Index) or tostring(Index)] = tonumber(Var) or tostring(Var) break end end end end return Table end function AutoLoot.TranslateString(Table) local String = "" if type(Table) ~= "table" then return String end for i, last in pairs(Table) do String = String..i..": ".. last ..", " end String = "a"..String.."a" return tostring(String) end function AutoLoot.getPlayerStorageZero(cid, key) return getPlayerStorageValue(cid, key) > 0 and getPlayerStorageValue(cid, key) or 0 end function AutoLoot.getStorageZero(key) return getGlobalStorageValue(key) > 0 and getGlobalStorageValue(key) or 0 end function AutoLoot.setPlayerTableStorage(cid, key, value) return doPlayerSetStorageValue(cid, key, AutoLoot.TranslateString(value)) end function AutoLoot.setGlobalTableStorage(key, value) return setGlobalStorageValue(key, AutoLoot.TranslateString(value)) end function AutoLoot.getPlayerTableStorage(cid, key) return AutoLoot.String(getPlayerStorageValue(cid, key)) end function AutoLoot.getGlobalTableStorage(key) return AutoLoot.String(getGlobalStorageValue(key)) end function AutoLoot.getPlayerList(cid) local Table = {} for i = 1, #AutoLoot.Storages.Slots do if getPlayerStorageValue(cid, AutoLoot.Storages.Slots) ~= -1 then table.insert(Table, getPlayerStorageValue(cid, AutoLoot.Storages.Slots)) end end return Table end function AutoLoot.ExistItemByName(name) local Items = io.open("data/items/items.xml", "r"):read("*all") local GetITEM = Items:match('name="' .. name ..'"') if GetITEM == nil or GetITEM == "" then return false end return true end function AutoLoot.addToList(cid, name) local ItemID = getItemIdByName(name) if AutoLoot.getPlayerList(cid) and isInArray(AutoLoot.getPlayerList(cid), ItemID) then return false end for i = 1, #AutoLoot.Storages.Slots do if getPlayerStorageValue(cid, AutoLoot.Storages.Slots) == -1 then doPlayerSetStorageValue(cid, AutoLoot.Storages.Slots, ItemID) return true end end end function AutoLoot.removeFromList(cid, name) local ItemID = getItemIdByName(name) for i = 1, #AutoLoot.Storages.Slots do if getPlayerStorageValue(cid, AutoLoot.Storages.Slots) == ItemID then doPlayerSetStorageValue(cid, AutoLoot.Storages.Slots, -1) return true end end return false end function AutoLoot.Boost(cid) return tonumber(getPlayerStorageValue(cid, AutoLoot.Storage_Boost)) >= os.time() end function AutoLoot.Items(cid, position) if not isPlayer(cid) then return true end local Check, String, Position = false, "", {} for i = 1, 255 do position.stackpos = i if getThingFromPos(position).uid and getThingFromPos(position).uid > 0 and isContainer(getThingFromPos(position).uid) then Position = position Check = true break end end if Check then local CorpseUID = AutoLoot.getContainerItemsInfo(getThingFromPos(Position).uid) if CorpseUID then for Index, Item in pairs(CorpseUID) do if Index < AutoLoot.CountTable(CorpseUID) then if Item.UID and Item.ItemID then if isContainer(Item.UID) then local Bag = AutoLoot.getContainerItemsInfo(Item.UID) for i = 1, AutoLoot.CountTable(Bag) do if isInArray(AutoLoot.getPlayerList(cid), Bag.ItemID) then if Bag.Count > 1 then if Bag.uid and Bag.uid > 0 then doRemoveItem(Bag.uid, Bag.Count) end doPlayerAddItem(cid, Bag.ItemID, Bag.Count) String = String.." ".. Bag.Count .." ".. getItemNameById(Bag.ItemID) .." +" else if Bag.uid and Bag.uid > 0 then doRemoveItem(Bag.uid) end if AutoLoot.Boost_Actived and AutoLoot.Boost(cid) then if AutoLoot_Boost[Bag.ItemID] then doPlayerSetBalance(cid, getPlayerBalance(cid) + AutoLoot_Boost[Bag.ItemID]) String = String.." 1 ".. getItemNameById(Bag.ItemID) .." (".. AutoLoot_Boost[Bag.ItemID] .."gp no banco) +" else doPlayerAddItem(cid, Bag.ItemID, 1) String = String.." 1 ".. getItemNameById(Bag.ItemID) .." +" end else doPlayerAddItem(cid, Bag.ItemID, 1) String = String.." 1 ".. getItemNameById(Bag.ItemID) .." +" end end end end end end end if isInArray(AutoLoot.getPlayerList(cid), Item.ItemID) then if Item.Count > 1 then if Item.UID and Item.UID > 0 then doRemoveItem(Item.UID, Item.Count) end doPlayerAddItem(cid, Item.ItemID, Item.Count) String = String.." ".. Item.Count .." ".. getItemNameById(Item.ItemID) .." +" else if Item.UID and Item.UID > 0 then doRemoveItem(Item.UID) end if AutoLoot.Boost_Actived and AutoLoot.Boost(cid) then if AutoLoot_Boost[Item.ItemID] then doPlayerSetBalance(cid,getPlayerBalance(cid) + AutoLoot_Boost[Item.ItemID]) String = String.." 1 "..getItemNameById(Item.ItemID).." ("..AutoLoot_Boost[Item.ItemID].."gps no banco) +" else doPlayerAddItem(cid, Item.ItemID, 1) String = String.." 1 "..getItemNameById(Item.ItemID).." +" end else doPlayerAddItem(cid, Item.ItemID, 1) String = String.." 1 "..getItemNameById(Item.ItemID).." +" end end end end end end AutoLoot.setPlayerTableStorage(cid, AutoLoot.Storages.Count_Table, {[1] = String, [2] = 0}) end function AutoLoot.Gold(cid, position) if not isPlayer(cid) then return true end local Check = false local Total_Gold = 0 local Position = {} for i = 1, 255 do position.stackpos = i if getThingFromPos(position).uid and getThingFromPos(position).uid > 0 and isContainer(getThingFromPos(position).uid) then Position = position Check = true break end end if Check then local CorpseUID = AutoLoot.getContainerItemsInfo(getThingFromPos(Position).uid) if CorpseUID then for Index, Item in pairs(CorpseUID) do if Item.UID and Item.ItemID then if Index < AutoLoot.CountTable(CorpseUID) then if isContainer(Item.UID) then local Bag = AutoLoot.getContainerItemsInfo(Item.UID) for i = 1, AutoLoot.CountTable(Bag) do if isInArray({2148, 2152, 2160}, Bag.ItemID) then local Multiplier = 1 if Bag.ItemID == 2148 then Multiplier = 1 elseif Bag.ItemID == 2152 then Multiplier = 100 elseif Bag.ItemID == 2160 then Multiplier = 10000 end if Bag.uid and Bag.uid > 0 then doRemoveItem(Bag.uid, Bag.Count) end doPlayerSetBalance(cid, getPlayerBalance(cid) + tonumber(Bag.Count) * Multiplier) Total_Gold = Total_Gold + Bag.Count * Multiplier doPlayerSetStorageValue(cid, AutoLoot.Storages.Count_Gold, tonumber(AutoLoot.getPlayerStorageZero(cid, AutoLoot.Storages.Count_Gold)) + tonumber(Item.Count) * tonumber(Multiplier)) end end end end if isInArray({2148, 2152, 2160}, Item.ItemID) then local Multiplier = 1 if Item.ItemID == 2148 then Multiplier = 1 elseif Item.ItemID == 2152 then Multiplier = 100 elseif Item.ItemID == 2160 then Multiplier = 10000 end if Item.UID and Item.UID > 0 then doRemoveItem(Item.UID, Item.Count) end doPlayerSetBalance(cid, getPlayerBalance(cid) + Item.Count * Multiplier) doPlayerSetStorageValue(cid, AutoLoot.Storages.Count_Gold, tonumber(AutoLoot.getPlayerStorageZero(cid, AutoLoot.Storages.Count_Gold)) + tonumber(Item.Count) * tonumber(Multiplier)) Total_Gold = Total_Gold + Item.Count * Multiplier end end end end end if Total_Gold > 0 then Total_Gold = Total_Gold - (Total_Gold * 0.2) Total_Gold = math.ceil(Total_Gold) doPlayerSetBalance(cid, getPlayerBalance(cid) + Total_Gold) local Table = AutoLoot.getPlayerTableStorage(cid, AutoLoot.Storages.Count_Table) Table[2] = Total_Gold AutoLoot.setPlayerTableStorage(cid, AutoLoot.Storages.Count_Table, Table) end end function AutoLoot.Message(cid) if not isPlayer(cid) then return true end local Table = AutoLoot.getPlayerTableStorage(cid, AutoLoot.Storages.Count_Table) if AutoLoot.CountTable(Table) >= 1 then if Table[1] then if Table[2] and Table[2] > 0 then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "[Auto Loot System] Coletados: ".. Table[1] .." ".. Table[2] .." gold coins.") else if type(Table[1]) == "string" and string.len(Table[1]) > 1 then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "[Auto Loot System] Coletados: "..Table[1]) end end elseif not Table[1] then if Table[2] then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "[Auto Loot System] Coletados: "..Table[2].." gold coins.") end end end doPlayerSetStorageValue(cid, AutoLoot.Storages.Count_Table, -1) end Ainda na pasta lib crie um arquivo .lua e coloque esse script dentro, ou faça o download do mesmo logo abaixo: Mostrar conteúdo oculto -- lib and functions by Vitor Bertolucci (Killua) function warnPlayersWithStorage(storage, value, class, message) -- By Killua if not value then value = 1 end if not class then class = MESSAGE_SATUS_CONSOLE_WARNING end if not storage or not message then return end if #getPlayersOnline() == 0 then return end for _, pid in pairs(getPlayersOnline()) do if getPlayerStorageValue(pid, storage) == value then doPlayerSendTextMessage(pid, class, message) end if getPlayerAccess(pid) >= 4 then doPlayerSendTextMessage(pid, class, "Message to those with storage "..storage..message) -- Gms will always receive the messages end end end function getPlayerStorageZero(cid, storage) -- By Killua local sto = getPlayerStorageValue(cid, storage) return sto > 0 and sto or 0 end function getStorageZero(storage) -- By Killua local sto = getGlobalStorageValue(storage) return sto > 0 and sto or 0 end function countTable(table) -- By Killua local y = 0 if type(table) == "table" then for _ in pairs(table) do y = y + 1 end return y end return false end function getPlayersInArea(frompos, topos) -- By Killua local players_ = {} local count = 1 for _, pid in pairs(getPlayersOnline()) do if isInArea(getCreaturePosition(pid), frompos, topos) then players_[count] = pid count = count + 1 end end return countTable(players_) > 0 and players_ or false end function getGuildNameById(gid) -- By Killua local query = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = '"..gid.."'") if query:getID() == -1 then return "" end local name = query:getDataString("name") query:free() return name end function getContainerItemsInfo(containerUid) -- By Killua local table = {} if containerUid and containerUid > 0 then local a = 0 for i = 0, getContainerSize(containerUid) - 1 do local item = getContainerItem(containerUid,i) a = a + 1 table[a] = {uid = item.uid, itemid = item.itemid, quant = item.type} end return table end return false end function getTableEqualValues(table) -- By Killua local ck = {} local eq = {} if type(table) == "table" then if countTable(table) and countTable(table) > 0 then for i = 1, countTable(table) do if not isInArray(ck, table) then ck = table else eq = table end end return countTable(eq) > 0 and eq or 0 end end return false end function killuaGetItemLevel(uid) -- By Killua local name = getItemName(uid) local pos = 0 for i = 1, #name do if string.byte(name:sub(i,i)) == string.byte('+') then pos = i + 1 break end end return tonumber(name:sub(pos,pos)) end k_table_storage_lib = { filtrateString = function(str) -- By Killua local tb, x, old, last = {}, 0, 0, 0 local first, second, final = 0, 0, 0 if type(str) ~= "string" then return tb end for i = 2, #str-1 do if string.byte(str:sub(i,i)) == string.byte(':') then x, second, last = x+1, i-1, i+2 for t = last,#str-1 do if string.byte(str:sub(t,t)) == string.byte(',') then first = x == 1 and 2 or old old, final = t+2, t-1 local index, var = str:sub(first,second), str:sub(last,final) tb[tonumber(index) or tostring(index)] = tonumber(var) or tostring(var) break end end end end return tb end, translateIntoString = function(tb) -- By Killua local str = "" if type(tb) ~= "table" then return str end for i, t in pairs(tb) do str = str..i..": "..t..", " end str = "a"..str.."a" return tostring(str) end } function setPlayerTableStorage(cid, key, value) -- By Killua return doPlayerSetStorageValue(cid, key, k_table_storage_lib.translateIntoString(value)) end function getPlayerTableStorage(cid, key) -- By Killua return k_table_storage_lib.filtrateString(getPlayerStorageValue(cid, key)) end function setGlobalTableStorage(key, value) -- By Killua return setGlobalStorageValue(key, k_table_storage_lib.translateIntoString(value)) end function getGlobalTableStorage(key) -- By Killua return k_table_storage_lib.filtrateString(getGlobalStorageValue(key)) end function printTable(table, includeIndices,prnt) -- By Killua if includeIndices == nil then includeIndices = true end if prnt == nil then prnt = true end if type(table) ~= "table" then error("Argument must be a table") return end local str, c = "{", "" for v, b in pairs(table) do if type(b) == "table" then str = includeIndices and str..c.."["..v.."]".." = "..printTable(b,true,false) or str..c..printTable(b,false,false) else str = includeIndices and str..c.."["..v.."]".." = "..b or str..c..b end c = ", " end str = str.."}" if prnt then print(str) end return str end function checkString(str) -- By Killua local check = true for i = 1, #str do local letra = string.byte(str:sub(i,i)) if letra >= string.byte('a') and letra <= string.byte('z') or letra >= string.byte('A') and letra <= string.byte('Z') or letra >= string.byte('0') and letra <= string.byte('9') then check = true else check = false break end end return check end function isArmor(itemid) -- By Killua return getItemInfo(itemid).armor > 0 end function isWeapon(uid) -- By Killua return getItemWeaponType(uid) ~= 0 end function isShield(uid) -- By Killua return getItemWeaponType(uid) == 5 end function isSword(uid) -- By Killua return getItemWeaponType(uid) == 1 end function isClub(uid) -- By Killua return getItemWeaponType(uid) == 2 end function isAxe(uid) -- By Killua return getItemWeaponType(uid) == 3 end function isBow(uid) -- By Killua return getItemWeaponType(uid) == 4 end function isWand(uid) -- By Killua return getItemWeaponType(uid) == 7 end Download: killua's lib.lua 6 kB · 4 downloads Isso é tudo pessoal! Informações: Este sistema funciona através de Premium Account, junto com ele vem o sistema de Autoloot Booster, que consiste em vender automaticamente os itens coletados. Foi testado em um servidor de Tibia 8.60 utilizando OTX 2. Créditos: @lordzetros @KOLISAO @Dwarfer Opa, sistema muito bom! Uma dúvida, teria como adicionar para Free poder usar apenas 2 slots, e VIP Storage 55555 usar 5 Slots?
Postado Outubro 9, 2022 2 anos tentei usar, mais nao deu muito certo, no meu caso, uso o comando !autoloot add, item name, porém não é coletado. E acaba crashando o game. Vai ver é a verão do tfs
Postado Setembro 6, 2023 1 ano Cara eu faço tudo certo, mas na hora que vou abrir o OT, ele fecha. Teria como me ajudar?
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.