Ir para conteúdo
  • Cadastre-se

(Resolvido)como abrir quantas tasks quiser? script do vodkart


Ir para solução Resolvido por Vodkart,

Posts Recomendados

@poko360 vc fez aquele negócio da database para trocar por int?

 

e vc editou a alguma parte da talk?

testei aqui e funcionou

OS7yer1.jpg

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
26 minutos atrás, Vodkart disse:

@poko360 vc fez aquele negócio da database para trocar por int?

fiz nao, tipo, nao entendi mt bem, tenho que ir la em "players_storage" é la?
tenho medo de mudar algo la e afetar todos os players

 

26 minutos atrás, Vodkart disse:

e vc editou a alguma parte da talk?

nao, mudei nd nao



EDIT:

image.png.6dd4ce6402f5de105b15c90d6685e578.png

mudei todos pra int, é assim? tem ctz que nao vai afetar em nada em relação ao sv? oO

EDIT 2:

mudei todos pra int, e continuou a mesma coisa =S

Editado por poko360 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

@poko360 mas ele já da esse erro direto? digamos que vc criar uma conta e digitar !task, já aparece isso?

 

deixa eu ver como ficou seu mods editado?

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

@Vodkart

 

Em 11/02/2020 em 07:16, Vodkart disse:

@poko360 mas ele já da esse erro direto? digamos que vc criar uma conta e digitar !task, já aparece isso?

 

ele so da o error quando digito !task
(inclusive com o novo char tambem, nao funciona)


e o lag voltou denovo:

Spoiler

image.thumb.png.d56e701375df90af9c8f4c2ac4ca7e41.png




meu mod ficou assim:

Spoiler

 

<?xml version="1.0" encoding="ISO-8859-1"?> 
<mod name="Automatic Simple Task" version="1.0" author="Vodkart" contact="tibiaking.com" enabled="no"> 
<config name="auto_stask"><![CDATA[

automatic_task = {
    {name = "Easy", storage = 761001, monsters_list = {"Cyclops","Cyclops Smith"}, can_repeat = true,  level_min = 1, count = 1000, reward = {}, exp = 0, money = 500000},
    {name = "Medium", storage = 761002, monsters_list = {"Dragon","Dragon lord"}, can_repeat = true,  level_min = 1, count = 1000, reward = {}, exp = 0, money = 2500000},
    {name = "Hard", storage = 761003, monsters_list = {"Hydra","Serpent Spawn"}, can_repeat = true,  level_min = 1, count = 1000, reward = {}, exp = 0, money = 5000000},
    {name = "Insane", storage = 761004, monsters_list = {"Wild Snow","Midnight Asura","Nature Djinn","Storm Djinn","[+10%] Wild Snow","[+10%] Midnight Asura","[+10%] Nature Djinn","[+10%] Storm Djinn"}, can_repeat = true,  level_min = 1, count = 1000, reward = {}, exp = 0, money = 7500000},
    {name = "Ultimate", storage = 761005, monsters_list = {"wizard","blackfrost","marauder","ferumbras","[+10%] wizard","[+10%] blackfrost","[+10%] marauder","[+10%] ferumbras"}, can_repeat = true,  level_min = 1, count = 1000, reward = {}, exp = 0, money = 10000000},
    {name = "RED", storage = 761006, monsters_list = {"red wizard","red blackfrost","red marauder","red ferumbras","[+10%] red wizard","[+10%] red blackfrost","[+10%] red marauder","[+10%] red ferumbras"}, can_repeat = true,  level_min = 1, count = 1000, reward = {}, exp = 0, money = 15000000},
    {name = "OOF", storage = 761007, monsters_list = {"oof"}, can_repeat = false,  level_min = 1, count = 25000, reward = {8977,1}, exp = 0, money = 0},
    {name = "Apolo", storage = 761008, monsters_list = {"apolo"}, can_repeat = true,  level_min = 1, count = 50, reward = {{6543,15},{8981,1}}, exp = 0, money = 0},
    {name = "Lyre", storage = 761009, monsters_list = {"lyre"}, can_repeat = true,  level_min = 1, count = 50, reward = {{10309,1},{2198,1}}, exp = 0, money = 0},
    {name = "Blue", storage = 761010, monsters_list = {"blue"}, can_repeat = true,  level_min = 1, count = 7, reward = {{10530,1},{12524,1}}, exp = 0, money = 0},
    {name = "Vip coin", storage = 761011, monsters_list = {"vip coin"}, can_repeat = false,  level_min = 1, count = 10, reward = {{11192,10}}, exp = 0, money = 0},
    {name = "Runes", storage = 761012, monsters_list = {"runes"}, can_repeat = true,  level_min = 1, count = 50, reward = {{2348,1}}, exp = 0, money = 0},
    {name = "Baby", storage = 761013, monsters_list = {"baby"}, can_repeat = true,  level_min = 1, count = 50, reward = {{4863,1}}, exp = 0, money = 0},
    {name = "Pingu", storage = 761014, monsters_list = {"pingu"}, can_repeat = true,  level_min = 1, count = 50, reward = {{6544,1}}, exp = 0, money = 0},
    {name = "Kayn", storage = 761015, monsters_list = {"kayn"}, can_repeat = true,  level_min = 1, count = 50, reward = {{9971,10}}, exp = 0, money = 0},
    {name = "Jake", storage = 761016, monsters_list = {"jake"}, can_repeat = true,  level_min = 1, count = 50, reward = {11390,10}, exp = 0, money = 0}
}

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[2] .. ' ' .. getItemNameById(items[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
            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, tonumber(getPlayerStorageValue(cid, automatic_task_config.defeat_storage)) <= 0 and 1 or 0)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Task System] O contador foi "..(tonumber(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 tonumber(getPlayerStorageValue(cid, v.storage)) < v.count then
    local amount = tonumber(getPlayerStorageValue(cid, v.storage)) <= 0 and 0 or tonumber(getPlayerStorageValue(cid, v.storage))
        str = str.."[+] "..v.name .." Task [+]\n\nMonster Count: ["..amount.."/"..v.count.."]\n\nMonsters Killing: "..getMonsterFromList(v.monsters_list)..".\nLevel: "..v.level_min.." or More.\nRewards: ".. (table.maxn(v.reward) > 0 and getItemsFromList(v.reward) or "Nothing") ..".\nMoney: ".. (v.money > 0 and v.money or 0) ..".\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 = tonumber(getPlayerStorageValue(cid, info.storage) <= 0 and 0 or getPlayerStorageValue(cid, info.storage))
                if tonumber(ret) < tonumber(info.count) then
                    setPlayerStorageValue(cid, info.storage, tonumber(getPlayerStorageValue(cid, info.storage) <= 0 and 1 or getPlayerStorageValue(cid, info.storage)+1))
                    if getPlayerStorageValue(cid, automatic_task_config.defeat_storage) <= 0 and tonumber(getPlayerStorageValue(cid, info.storage)) < info.count then
                        doPlayerSendTextMessage(cid, 24,"[Task System] defeated Total [" .. tonumber(getPlayerStorageValue(cid, info.storage)) .. "/" .. info.count .. "] da Task do " .. info.name .. ".")
                    end
                    if tonumber(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>

 

 

Editado por poko360 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução

@poko360 tinha mta coisa faltando, quando vc copiou saiu várias funções n sei pq

 

pega daqui:

 

 

https://pastebin.com/raw/kF7TLf9A

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
  • 2 weeks later...

@Vodkart
pelo q entendi o problema ta aqui:
[1:6:39.456] [string "LuaInterface::loadBuffer"]:7: attempt to compare string with number
[1:6:39.460] stack traceback:
[1:6:39.461]    [string "LuaInterface::loadBuffer"]:7: in function <[string "LuaInterface::loadBuffer"]:2>

nessa parte do script aqui

Spoiler

<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 = tonumber(getPlayerStorageValue(cid, info.storage) <= 0 and 0 or getPlayerStorageValue(cid, info.storage))
                if tonumber(ret) < tonumber(info.count) then
                    setPlayerStorageValue(cid, info.storage, tonumber(getPlayerStorageValue(cid, info.storage) <= 0 and 1 or getPlayerStorageValue(cid, info.storage)+1))
                    if getPlayerStorageValue(cid, automatic_task_config.defeat_storage) <= 0 and tonumber(getPlayerStorageValue(cid, info.storage)) < info.count then
                        doPlayerSendTextMessage(cid, 24,"[Task System] defeated Total [" .. tonumber(getPlayerStorageValue(cid, info.storage)) .. "/" .. info.count .. "] da Task do " .. info.name .. ".")
                    end
                    if tonumber(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>

acho que é na hora que o script zera as tasks, que da algum error.
tens alguma ideia doq seja nao? =s

Editado por poko360 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 3 years later...

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo