• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Task system - tfs 1.3

amoxicilina

Member
Joined
Jun 25, 2010
Messages
72
Reaction score
11
hello brothers, i am having a problem with my task system, follow image and .lua lib and npc.


1581637184040.png

Lua:
task_monsters = {
    [1] = {name = "troll", storage = 5101, monsters_list = {"troll","frost troll","island troll","furious troll","swamp troll"}, amount = 10, exp = 20000, pointsTask = 1, items = {{id = 2160, count = 2}}},
}

task_daily = {
    [1] = {name = "fire elementals", storage = 5201, monsters_list = {"fire elemental","massive fire elemental","blazing fire elemental","blistering fire elemental"}, amount = 70, exp = 50000, pointsTask = 1, items = {{id = 2160, count = 1}}},
}

-- lembrando que os monsters na "name" e na "monsters_list" devem ser sempre em letra minuscula!

task_current = 5000 -- storage que verifica se esta fazendo alguma task e ver qual - task normal
task_points = 5001 -- storage que retorna a quantidade de pontos task que o player tem.
task_delay = 5002 -- storage de delay para nao poder fazer a task novamente caso ela for abandonada.
task_time = 2 -- tempo em horas em que o player ficara sem fazer a task como punicao
task_rank = 5003 -- storage do rank task
task_daily_current = 5004 -- storage que verifica se esta fazendo alguma task e ver qual - task daily
task_daily_time = 5005 -- storage do tempo da task daily, no caso para verificar e add 24 horas para fazer novamente a task daily

local ranks_task = {
    [{0, 50}] = "Novato",
    [{51, 100}] = "Elite",
    [{101, 200}] = "Master",
    [{201, 300}] = "Destruidor",       
    [{301, math.huge}] = "Juggernaut"
}

function Player.getTask(self)
    return self:getStorageValue(task_current) > 0 and task_monsters[self:getStorageValue(task_current)] or false
end

function Player.getDailyTask(self)
    return self:getStorageValue(task_daily_current) > 0 and task_daily[self:getStorageValue(task_daily_current)] or false
end

function Player.getTaskPoints(self)
    return self:getStorageValue(task_points) > 0 and self:getStorageValue(task_points) or 0
end

function Player.addTaskPoints(self, count)
    return self:setStorageValue(task_points, self:getTaskPoints() + count)
end

function Player.removeTaskPoints(self, count)
    return self:setStorageValue(task_points, self:getTaskPoints() - count)
end

function Player.rankTask(self)
    local pontos = self:getTaskPoints()
    for rank, rankName in pairs(ranks_task) do
        if pontos >= rank[1] and pontos <= rank[2] then
            return rankName
        end
    end
    return 0
end

function getItemsFromTable(itemtable)
    local text = ""
    for v = 1, #itemtable do
        local count, info = itemtable[v].count, ItemType(itemtable[v].id)
        local ret = ", "
        if v == 1 then
            ret = ""
        elseif v == #itemtable then
            ret = " - "
        end
        text = text .. ret
        text = text .. (count > 1 and count or info:getArticle()).." "..(count > 1 and info:getPluralName() or info:getName())
    end
    return text
end

function Player.taskReward(self, points, items, exp, storage_task, storage_task_current)
    local txt = "Thanks for doing the task, your awards are: "..points.." task points, "
    if #getItemsFromTable(items) > 0 then
        txt = txt.." "..getItemsFromTable(items)..", "
        for x = 1, #items do
            self:addItem(items[x].id, items[x].count)
        end
    end
    if exp > 0 then
        txt = txt.." "..exp.." of experience, "
        self:addExperience(exp)
    end
    text = txt.." and even more!"
    self:addTaskPoints(points)
    self:setStorageValue(storage_task, 0)
    self:setStorageValue(storage_task_current, 0)
    return txt
end

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then return false end
    local player = Player(cid)
    local msg = msg:lower()
    ------------------------------------------------------------------
    if npcHandler.topic[cid] == 0 and (msgcontains(msg, "task") or msgcontains(msg, 'mission') or msgcontains(msg, 'tasks')) then
    if getPlayerStorageValue(cid, Storage.TheShatteredIsles.TheErrand) >= 4 then
return npcHandler:say("Volte quando terminar as tarefas do Raphael.", cid)
end
        if player:getTask() then
            local task = player:getTask()
            if player:getStorageValue(task.storage) == task.amount then
                player:taskReward(task.pointsTask, task.items, task.exp, task.storage, task_current)
                npcHandler:say(txt, cid) -- problema
                npcHandler:releaseFocus(cid)
            end
        elseif player:getDailyTask() then
            local task = player:getDailyTask()
            if player:getStorageValue(task.storage) == task.amount then
                player:taskReward(task.pointsTask, task.items, task.exp, task.storage, task_daily_current)
                player:setStorageValue(task_daily_time, 1 * 60 * 60 * 24 + os.time())
                npcHandler:say(old, cid) -- problema
                npcHandler:releaseFocus(cid)
            end
        end

        npcHandler:say("Muito Bem, Você gostaria de realizar uma {task} ou {daily} task? ou você gostaria de {quit} uma tarefa que você está fazendo?", cid)
        npcHandler.topic[cid] = 1
    ------------------------------------------------------------------
    elseif npcHandler.topic[cid] == 1 and msgcontains(msg, "task") then
        if player:getStorageValue(task_delay) < os.time() then
            if player:getStorageValue(task_current) <= 0 then
                local text = "You can choose between tasks:"
                for _, task in pairs(task_monsters) do
                    text = text .." {"..task.name.."},"
                end
                npcHandler:say(text.." me diga qual você quer fazer?", cid)
                npcHandler.topic[cid] = 2
            else
                npcHandler:say("Você já está fazendo uma tarefa. Você pode fazer apenas um de cada vez. Diga {!task} para ver informações sobre sua tarefa atual. Ou use {quit} para cancelar a tarefa.", cid)
            end
        else
            npcHandler:say("Não tenho permissão para atribuir tarefas, porque você abandonou a tarefa anterior. Aguarde até as 2 horas de punição terminarem.", cid)
        end   
    elseif npcHandler.topic[cid] == 2 then
        for task_number, task in pairs(task_monsters) do
            if msg == task.name then
                npcHandler:say("Muito bem, agora você está fazendo a tarefa de {"..task.name:gsub("^%l", string.upper).."}, você precisa matar "..task.amount .." deles. Boa sorte!", cid)
                player:setStorageValue(task_current, task_number)
                player:setStorageValue(task.storage, 0)
                npcHandler:releaseFocus(cid)
            else
                npcHandler:say("Desculpe, não temos esta tarefa.", cid)
            end
        end
    ------------------------------------------------------------------
    elseif msgcontains(msg, "daily") then
        if player:getStorageValue(task_daily_time) < os.time() then
            if player:getStorageValue(task_delay) < os.time() then
                if player:getStorageValue(task_daily_current) <= 0 then
                    local text = "Você pode escolher entre tarefas diárias:"
                    for _, task in pairs(task_daily) do
                        text = text .." {"..task.name.."},"
                    end
                    npcHandler:say(text.."me diga qual você quer fazer?", cid)
                    npcHandler.topic[cid] = 3
                else
                    npcHandler:say("Você já está fazendo uma tarefa diária. Você pode fazer apenas um por dia. Diga {!Task} para ver informações sobre sua tarefa atual. Ou use {quit} para cancelar a tarefa diária.", cid)
                end
            else
                npcHandler:say("Não tenho permissão para atribuir tarefas, porque você abandonou a tarefa anterior. Aguarde até as 2 horas de punição terminarem.", cid)
            end
        else
            npcHandler:say("Você concluiu a tarefa diária de hoje. Espere gastar 24 horas para fazê-lo novamente.", cid)
        end
    elseif npcHandler.topic[cid] == 3 then
        for task_number, task in pairs(task_daily) do
            if msg == task.name then
                npcHandler:say("Muito bem, agora você está realizando a tarefa diária de {"..task.name:gsub("^%l", string.upper).."}, você precisa matar "..task.amount.." deles. Boa sorte!", cid)
                player:setStorageValue(task_daily_current, task_number)
                player:setStorageValue(task.storage, 0)
                npcHandler:releaseFocus(cid)
            else
                npcHandler:say("Desculpe, não temos esta tarefa diária.", cid)
            end
        end
    ------------------------------------------------------------------
    elseif msgcontains(msg, "quit") then
        if npcHandler.topic[cid] == 0 then
            npcHandler:say("Que tipo de tarefa você deseja encerrar, {task} ou {daily}?", cid)
            npcHandler.topic[cid] = 4
        end
    elseif npcHandler.topic[cid] == 4 and msgcontains(msg, "task") then
        if player:getTask() then
            npcHandler:say("Infeliz esta situação, tinha fé que você me traria esta missão feita, mais estava errado. Como punição serão 2 horas sem poder executar nenhuma tarefa.", cid)
            player:setStorageValue(task_delay, os.time() + task_time * 60 * 60)
            player:setStorageValue(player:getTask().storage, 0)
            player:setStorageValue(task_current, 0)
            npcHandler:releaseFocus(cid)
        else
            npcHandler:say("Você não está realizando nenhuma tarefa para poder abandoná-la.", cid)
        end
    elseif npcHandler.topic[cid] == 4 and msgcontains(msg, "daily") then
        if player:getDailyTask() then
            npcHandler:say("Infeliz esta situação, tinha fé que você me traria esta missão feita, mais estava errado. Como punição serão 2 horas sem poder executar nenhuma tarefa.", cid)
            player:setStorageValue(task_delay, os.time() + task_time * 60 * 60)
            player:setStorageValue(player:getDailyTask().storage, 0)
            player:setStorageValue(task_daily_current, 0)
            npcHandler:releaseFocus(cid)
        else
            npcHandler:say("Você não está realizando nenhuma tarefa diária para poder abandoná-la.", cid)
        end
    end
end
npcHandler:setMessage(MESSAGE_GREET, "Oi |PLAYERNAME|. Procura por algo?.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:setMessage(MESSAGE_FAREWELL, 'Feliz caça, meu velho!')
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
How come you aren't using Limos task system? Isn't it working on your distro?
Or do you want to create your own?

Limo's Task System, it works on the latest TFS from git hub as well.
Currently using it myself.
 
Last edited:
yes, i would like my own. There was only one error in it that I would like to know how to fix, it works all normal more at the time of the npc sends a message saying what was the reward he does not speak, but he delivers as configured.
How come you aren't using Limos task system? Isn't it working on your distro?
Or do you want to create your own?

Limo's Task System, it works on the latest TFS from git hub as well.
Currently using it myself.
 
Do you get console errors if you use this npc script instead?

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then return false end
    local player = Player(cid)
    local msg = msg:lower()
    ------------------------------------------------------------------
    if npcHandler.topic[cid] == 0 and (msgcontains(msg, "task") or msgcontains(msg, 'mission') or msgcontains(msg, 'tasks')) then
    if getPlayerStorageValue(cid, Storage.TheShatteredIsles.TheErrand) >= 4 then
return npcHandler:say("Volte quando terminar as tarefas do Raphael.", cid)
end
        if player:getTask() then
            local task = player:getTask()
            if player:getStorageValue(task.storage) == task.amount then
                player:taskReward(task.pointsTask, task.items, task.exp, task.storage, task_current)
                npcHandler:say("I am a teapot.", cid) -- problema
                npcHandler:releaseFocus(cid)
            end
        elseif player:getDailyTask() then
            local task = player:getDailyTask()
            if player:getStorageValue(task.storage) == task.amount then
                player:taskReward(task.pointsTask, task.items, task.exp, task.storage, task_daily_current)
                player:setStorageValue(task_daily_time, 1 * 60 * 60 * 24 + os.time())
                npcHandler:say("Short and stout, here is my handle here is my spout.", cid) -- problema
                npcHandler:releaseFocus(cid)
            end
        end

        npcHandler:say("Muito Bem, Você gostaria de realizar uma {task} ou {daily} task? ou você gostaria de {quit} uma tarefa que você está fazendo?", cid)
        npcHandler.topic[cid] = 1
    ------------------------------------------------------------------
    elseif npcHandler.topic[cid] == 1 and msgcontains(msg, "task") then
        if player:getStorageValue(task_delay) < os.time() then
            if player:getStorageValue(task_current) <= 0 then
                local text = "You can choose between tasks:"
                for _, task in pairs(task_monsters) do
                    text = text .." {"..task.name.."},"
                end
                npcHandler:say(text.." me diga qual você quer fazer?", cid)
                npcHandler.topic[cid] = 2
            else
                npcHandler:say("Você já está fazendo uma tarefa. Você pode fazer apenas um de cada vez. Diga {!task} para ver informações sobre sua tarefa atual. Ou use {quit} para cancelar a tarefa.", cid)
            end
        else
            npcHandler:say("Não tenho permissão para atribuir tarefas, porque você abandonou a tarefa anterior. Aguarde até as 2 horas de punição terminarem.", cid)
        end  
    elseif npcHandler.topic[cid] == 2 then
        for task_number, task in pairs(task_monsters) do
            if msg == task.name then
                npcHandler:say("Muito bem, agora você está fazendo a tarefa de {"..task.name:gsub("^%l", string.upper).."}, você precisa matar "..task.amount .." deles. Boa sorte!", cid)
                player:setStorageValue(task_current, task_number)
                player:setStorageValue(task.storage, 0)
                npcHandler:releaseFocus(cid)
            else
                npcHandler:say("Desculpe, não temos esta tarefa.", cid)
            end
        end
    ------------------------------------------------------------------
    elseif msgcontains(msg, "daily") then
        if player:getStorageValue(task_daily_time) < os.time() then
            if player:getStorageValue(task_delay) < os.time() then
                if player:getStorageValue(task_daily_current) <= 0 then
                    local text = "Você pode escolher entre tarefas diárias:"
                    for _, task in pairs(task_daily) do
                        text = text .." {"..task.name.."},"
                    end
                    npcHandler:say(text.."me diga qual você quer fazer?", cid)
                    npcHandler.topic[cid] = 3
                else
                    npcHandler:say("Você já está fazendo uma tarefa diária. Você pode fazer apenas um por dia. Diga {!Task} para ver informações sobre sua tarefa atual. Ou use {quit} para cancelar a tarefa diária.", cid)
                end
            else
                npcHandler:say("Não tenho permissão para atribuir tarefas, porque você abandonou a tarefa anterior. Aguarde até as 2 horas de punição terminarem.", cid)
            end
        else
            npcHandler:say("Você concluiu a tarefa diária de hoje. Espere gastar 24 horas para fazê-lo novamente.", cid)
        end
    elseif npcHandler.topic[cid] == 3 then
        for task_number, task in pairs(task_daily) do
            if msg == task.name then
                npcHandler:say("Muito bem, agora você está realizando a tarefa diária de {"..task.name:gsub("^%l", string.upper).."}, você precisa matar "..task.amount.." deles. Boa sorte!", cid)
                player:setStorageValue(task_daily_current, task_number)
                player:setStorageValue(task.storage, 0)
                npcHandler:releaseFocus(cid)
            else
                npcHandler:say("Desculpe, não temos esta tarefa diária.", cid)
            end
        end
    ------------------------------------------------------------------
    elseif msgcontains(msg, "quit") then
        if npcHandler.topic[cid] == 0 then
            npcHandler:say("Que tipo de tarefa você deseja encerrar, {task} ou {daily}?", cid)
            npcHandler.topic[cid] = 4
        end
    elseif npcHandler.topic[cid] == 4 and msgcontains(msg, "task") then
        if player:getTask() then
            npcHandler:say("Infeliz esta situação, tinha fé que você me traria esta missão feita, mais estava errado. Como punição serão 2 horas sem poder executar nenhuma tarefa.", cid)
            player:setStorageValue(task_delay, os.time() + task_time * 60 * 60)
            player:setStorageValue(player:getTask().storage, 0)
            player:setStorageValue(task_current, 0)
            npcHandler:releaseFocus(cid)
        else
            npcHandler:say("Você não está realizando nenhuma tarefa para poder abandoná-la.", cid)
        end
    elseif npcHandler.topic[cid] == 4 and msgcontains(msg, "daily") then
        if player:getDailyTask() then
            npcHandler:say("Infeliz esta situação, tinha fé que você me traria esta missão feita, mais estava errado. Como punição serão 2 horas sem poder executar nenhuma tarefa.", cid)
            player:setStorageValue(task_delay, os.time() + task_time * 60 * 60)
            player:setStorageValue(player:getDailyTask().storage, 0)
            player:setStorageValue(task_daily_current, 0)
            npcHandler:releaseFocus(cid)
        else
            npcHandler:say("Você não está realizando nenhuma tarefa diária para poder abandoná-la.", cid)
        end
    end
end
npcHandler:setMessage(MESSAGE_GREET, "Oi |PLAYERNAME|. Procura por algo?.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:setMessage(MESSAGE_FAREWELL, 'Feliz caça, meu velho!')
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
Do you get console errors if you use this npc script instead?

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then return false end
    local player = Player(cid)
    local msg = msg:lower()
    ------------------------------------------------------------------
    if npcHandler.topic[cid] == 0 and (msgcontains(msg, "task") or msgcontains(msg, 'mission') or msgcontains(msg, 'tasks')) then
    if getPlayerStorageValue(cid, Storage.TheShatteredIsles.TheErrand) >= 4 then
return npcHandler:say("Volte quando terminar as tarefas do Raphael.", cid)
end
        if player:getTask() then
            local task = player:getTask()
            if player:getStorageValue(task.storage) == task.amount then
                player:taskReward(task.pointsTask, task.items, task.exp, task.storage, task_current)
                npcHandler:say("I am a teapot.", cid) -- problema
                npcHandler:releaseFocus(cid)
            end
        elseif player:getDailyTask() then
            local task = player:getDailyTask()
            if player:getStorageValue(task.storage) == task.amount then
                player:taskReward(task.pointsTask, task.items, task.exp, task.storage, task_daily_current)
                player:setStorageValue(task_daily_time, 1 * 60 * 60 * 24 + os.time())
                npcHandler:say("Short and stout, here is my handle here is my spout.", cid) -- problema
                npcHandler:releaseFocus(cid)
            end
        end

        npcHandler:say("Muito Bem, Você gostaria de realizar uma {task} ou {daily} task? ou você gostaria de {quit} uma tarefa que você está fazendo?", cid)
        npcHandler.topic[cid] = 1
    ------------------------------------------------------------------
    elseif npcHandler.topic[cid] == 1 and msgcontains(msg, "task") then
        if player:getStorageValue(task_delay) < os.time() then
            if player:getStorageValue(task_current) <= 0 then
                local text = "You can choose between tasks:"
                for _, task in pairs(task_monsters) do
                    text = text .." {"..task.name.."},"
                end
                npcHandler:say(text.." me diga qual você quer fazer?", cid)
                npcHandler.topic[cid] = 2
            else
                npcHandler:say("Você já está fazendo uma tarefa. Você pode fazer apenas um de cada vez. Diga {!task} para ver informações sobre sua tarefa atual. Ou use {quit} para cancelar a tarefa.", cid)
            end
        else
            npcHandler:say("Não tenho permissão para atribuir tarefas, porque você abandonou a tarefa anterior. Aguarde até as 2 horas de punição terminarem.", cid)
        end 
    elseif npcHandler.topic[cid] == 2 then
        for task_number, task in pairs(task_monsters) do
            if msg == task.name then
                npcHandler:say("Muito bem, agora você está fazendo a tarefa de {"..task.name:gsub("^%l", string.upper).."}, você precisa matar "..task.amount .." deles. Boa sorte!", cid)
                player:setStorageValue(task_current, task_number)
                player:setStorageValue(task.storage, 0)
                npcHandler:releaseFocus(cid)
            else
                npcHandler:say("Desculpe, não temos esta tarefa.", cid)
            end
        end
    ------------------------------------------------------------------
    elseif msgcontains(msg, "daily") then
        if player:getStorageValue(task_daily_time) < os.time() then
            if player:getStorageValue(task_delay) < os.time() then
                if player:getStorageValue(task_daily_current) <= 0 then
                    local text = "Você pode escolher entre tarefas diárias:"
                    for _, task in pairs(task_daily) do
                        text = text .." {"..task.name.."},"
                    end
                    npcHandler:say(text.."me diga qual você quer fazer?", cid)
                    npcHandler.topic[cid] = 3
                else
                    npcHandler:say("Você já está fazendo uma tarefa diária. Você pode fazer apenas um por dia. Diga {!Task} para ver informações sobre sua tarefa atual. Ou use {quit} para cancelar a tarefa diária.", cid)
                end
            else
                npcHandler:say("Não tenho permissão para atribuir tarefas, porque você abandonou a tarefa anterior. Aguarde até as 2 horas de punição terminarem.", cid)
            end
        else
            npcHandler:say("Você concluiu a tarefa diária de hoje. Espere gastar 24 horas para fazê-lo novamente.", cid)
        end
    elseif npcHandler.topic[cid] == 3 then
        for task_number, task in pairs(task_daily) do
            if msg == task.name then
                npcHandler:say("Muito bem, agora você está realizando a tarefa diária de {"..task.name:gsub("^%l", string.upper).."}, você precisa matar "..task.amount.." deles. Boa sorte!", cid)
                player:setStorageValue(task_daily_current, task_number)
                player:setStorageValue(task.storage, 0)
                npcHandler:releaseFocus(cid)
            else
                npcHandler:say("Desculpe, não temos esta tarefa diária.", cid)
            end
        end
    ------------------------------------------------------------------
    elseif msgcontains(msg, "quit") then
        if npcHandler.topic[cid] == 0 then
            npcHandler:say("Que tipo de tarefa você deseja encerrar, {task} ou {daily}?", cid)
            npcHandler.topic[cid] = 4
        end
    elseif npcHandler.topic[cid] == 4 and msgcontains(msg, "task") then
        if player:getTask() then
            npcHandler:say("Infeliz esta situação, tinha fé que você me traria esta missão feita, mais estava errado. Como punição serão 2 horas sem poder executar nenhuma tarefa.", cid)
            player:setStorageValue(task_delay, os.time() + task_time * 60 * 60)
            player:setStorageValue(player:getTask().storage, 0)
            player:setStorageValue(task_current, 0)
            npcHandler:releaseFocus(cid)
        else
            npcHandler:say("Você não está realizando nenhuma tarefa para poder abandoná-la.", cid)
        end
    elseif npcHandler.topic[cid] == 4 and msgcontains(msg, "daily") then
        if player:getDailyTask() then
            npcHandler:say("Infeliz esta situação, tinha fé que você me traria esta missão feita, mais estava errado. Como punição serão 2 horas sem poder executar nenhuma tarefa.", cid)
            player:setStorageValue(task_delay, os.time() + task_time * 60 * 60)
            player:setStorageValue(player:getDailyTask().storage, 0)
            player:setStorageValue(task_daily_current, 0)
            npcHandler:releaseFocus(cid)
        else
            npcHandler:say("Você não está realizando nenhuma tarefa diária para poder abandoná-la.", cid)
        end
    end
end
npcHandler:setMessage(MESSAGE_GREET, "Oi |PLAYERNAME|. Procura por algo?.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:setMessage(MESSAGE_FAREWELL, 'Feliz caça, meu velho!')
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

worked perfectly. so I’d like to receive a reward message that I’m getting when I deliver an assignment. would it be possible to do that?
 
Back
Top