local taskActive = 19000 local tasks = { ['rotworm'] = {storage = 19002, experience = nil, items = nil, premiumpoints = nil, str = "rotworm", count = 10, outfitId = 128, outfitIdfemale = 136, addon = 1}, } function onSay(cid, words, param, channel) if(param == "info") then for name, params in pairs(tasks) do if(getPlayerStorageValue(cid, params.storage) > 0) then local ss = "" ss = "Name: " .. name .. "\n" ss = ss .. "Kills: " .. getPlayerStorageValue(cid, params.storage + 200) .. "\n" ss = ss .. "Kills left: " .. (params.count - getPlayerStorageValue(cid, params.storage + 200)) .. "\n" ss = ss .. "Kills required: " .. params.count .. "\n" doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ss) end end else local task = tasks[param] if(not task) then return true end local taskEnd = math.max(0, task.storage + 400) if(getPlayerStorageValue(cid, taskEnd) == 1) then doPlayerSendCancel(cid, "You already complete this task.") return true end if(getPlayerStorageValue(cid, task.storage) <= 0) then if(getPlayerStorageValue(cid, taskActive) > 0) then for name, params in pairs(tasks) do if(getPlayerStorageValue(cid, params.storage) > 0) then doPlayerSendCancel(cid, "First complete " .. params.str .. " task.") break end end else setPlayerStorageValue(cid, taskActive, 1) setPlayerStorageValue(cid, task.storage, 1) setPlayerStorageValue(cid, task.storage + 200, 0) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Task [" .. task.str .. "] has been activated.") end else setPlayerStorageValue(cid, taskActive, 0) setPlayerStorageValue(cid, task.storage, 0) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Task [" .. task.str .. "] has been deactivated.") end end return true end