Postado Janeiro 30, 2020 5 anos @poko360 entendi, então eu fiz de forma individual, para colocar na propria tabela...: <?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Automatic Simple Task" version="1.0" author="Vodkart" contact="tibiaking.com" enabled="yes"> <config name="auto_stask"><![CDATA[ automatic_task = { [1] = {name = "Trolls", storage = 761000, monsters_list = {"Troll","Troll champion"}, can_repeat = true, level_min = 10, count = 5, reward = {{2173,1}}, exp = 2000, money = 2000}, [2] = {name = "rotworms", storage = 761001, monsters_list = {"rotworm","carrion worm","Rotworm Queen"}, can_repeat = true, level_min = 11, count = 6, reward = {{2173,1},{2159,10}}, exp = 2500, money = 3000}, [3] = {name = "cyclops", storage = 761002, monsters_list = {"cyclops","cyclops smith","cyclops drone"}, can_repeat = true, level_min = 12, count = 7, reward = {{2173,2},{2159,50}}, exp = 3000, money = 3000}, [4] = {name = "ORSHABAAL BOSS", storage = 761003, monsters_list = {"orshabaal"}, can_repeat = false, level_min = 15, count = 1, reward = {{2173,2},{2159,100}}, exp = 10000, money = 10000} } automatic_task_config = { reward_type = MESSAGE_STATUS_CONSOLE_BLUE, defeat_type = MESSAGE_STATUS_CONSOLE_ORANGE, defeat_storage = 963850, lvl_advance_control = 963851 } function getItemsFromList(items) local str = '' if table.maxn(items) > 0 then for i = 1, table.maxn(items) do str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1]) if i ~= table.maxn(items) then str = str .. ', ' end end end return str end function getMonsterFromList(monster) local str = '' if #monster > 0 then for i = 1, #monster do str = str .. monster[i] if i ~= #monster then str = str .. ', ' end end end return str end function GiveRewardsTask(cid, items) local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID for _, i_i in ipairs(items) do local item, amount = i_i[1],i_i[2] if isItemStackable(item) or amount == 1 then doAddContainerItem(backpack, item, amount) else for i = 1, amount do doAddContainerItem(backpack, item, 1) end end end end ]]></config> <event type="advance" name="TaskAutAdvance" event="script"><![CDATA[ domodlib('auto_stask') function onAdvance(cid, skill, oldLevel, newLevel) if (skill == SKILL__LEVEL) then if getPlayerStorageValue(cid, automatic_task_config.lvl_advance_control) < newLevel then for k, v in pairs(automatic_task) do if v.level_min == newLevel then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Task System] Voce Desbloqueou a "..v.name.." Task! Parabéns!") end end setPlayerStorageValue(cid, automatic_task_config.lvl_advance_control, newLevel) end end return true end]]></event> <talkaction words="/task;!task" event="buffer"><![CDATA[ domodlib('auto_stask') param, str = param:lower(),"Task(s) Disponiveis:\n\n" if isInArray({"counter","contador","count"},param) then setPlayerStorageValue(cid, automatic_task_config.defeat_storage, getPlayerStorageValue(cid, automatic_task_config.defeat_storage) <= 0 and 1 or 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Task System] O contador foi "..(getPlayerStorageValue(cid, automatic_task_config.defeat_storage) <= 0 and "ativado" or "desativado")..".") return true end for k, v in pairs(automatic_task) do if getPlayerLevel(cid) >= v.level_min and getPlayerStorageValue(cid, v.storage) < v.count then local amount = getPlayerStorageValue(cid, v.storage) <= 0 and 0 or getPlayerStorageValue(cid, v.storage) str = str.."[+] "..v.name .." Task [+]\n\nMonster Count: ["..amount.."/"..v.count.."]\n\nMonsters Killing: "..getMonsterFromList(v.monsters_list)..".\n\nLevel: "..v.level_min.." or More.\n\nCan repeat: ".. ( v.can_repeat == true and "yes" or "no" )..".\n\nRewards: ".. (table.maxn(v.reward) > 0 and getItemsFromList(v.reward) or "Nothing") ..".\n\nExp: ".. (v.exp > 0 and v.exp or 0) ..".\n\nMoney: ".. (v.money > 0 and v.money or 0) ..".\n\n" end end return doShowTextDialog(cid, 8983, str) ]]></talkaction> <event type="login" name="TaskAutLogin" event="script"><![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "KillAutTask") registerCreatureEvent(cid, "TaskAutAdvance") return true end]]></event> <event type="kill" name="KillAutTask" event="script"><![CDATA[ domodlib('auto_stask') function onKill(cid, target) local str = "" if isPlayer(cid) and isMonster(target) then for task , info in pairs(automatic_task) do if isInArray(info.monsters_list, getCreatureName(target):lower()) and getPlayerLevel(cid) >= info.level_min then local ret = getPlayerStorageValue(cid, info.storage) <= 0 and 0 or getPlayerStorageValue(cid, info.storage) if ret < info.count then setPlayerStorageValue(cid, info.storage, getPlayerStorageValue(cid, info.storage) <= 0 and 1 or (getPlayerStorageValue(cid, info.storage)+1)) if getPlayerStorageValue(cid, automatic_task_config.defeat_storage) <= 0 and getPlayerStorageValue(cid, info.storage) < info.count then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] defeated Total [" .. getPlayerStorageValue(cid, info.storage) .. "/" .. info.count .. "] da Task do " .. info.name .. ".") end if getPlayerStorageValue(cid, info.storage) >= info.count then if info.exp > 0 then doPlayerAddExp(cid, info.exp) str = str.."".. (str == "" and "" or ", ") .." "..info.exp.." de exp" end if info.money > 0 then doPlayerAddMoney(cid, info.money) str = str.."".. (str == "" and "" or ", ") ..""..info.money.." gps" end if table.maxn(info.reward) > 0 then GiveRewardsTask(cid, info.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(info.reward) end doPlayerSendTextMessage(cid, automatic_task_config.reward_type, "[Task System] Voce completou a "..info.name.." Task. Obrigado pela sua ajuda!! Suas Recompensas: "..(str == "" and "nenhuma" or str)) if info.can_repeat == true then setPlayerStorageValue(cid, info.storage, 0) end end end end end end return true end]]></event> </mod> [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Fevereiro 4, 2020 5 anos Autor opa @Vodkart, surgiu um bugzinho que ta fazendo travar o servidor segue a foto abaixo: Spoiler
Postado Fevereiro 4, 2020 5 anos @poko360 é qndo termina a task? ou em algum monstro especifico? testei aqui e não apareceu esse erro... vc não está usando as mesmas storages da task antiga né? [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Fevereiro 4, 2020 5 anos Autor @Vodkart nao, nao estou usando as mesmas storages das tasks antigas tipo, funcionou 100% desde que daquele dia que te dei rep +, so que hoje começou a dar esse error, algum player tentou burlar (nao sei) tipo, n tem como eu saber oq ocorreu, o server so começou a travar e ficava spammando essa msg da foto varias vezes
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.