• 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!

CreatureEvent [CreatureEvent/Npc] Killing in the name of...

Thanks, now that bug doesn't appear and NPC shows me list of tasks (he didn't do it before)

But Grizzly Adams still does not give any rewards :/ Everything works fine, until this moment :/ anyone has an idea? no bugs in console, tf 0.4

I'll try fix it.
 
Does this work on tfs 1.x?
Short answer: no.

Long answer: it might be, most of the functions on TFS 0.x have compatibility layers on TFS 1.x and you can drop in and it can work 100%, but you will have to look through code to be certain to try and fix arising issues.
 
I am focusing a problem with the npc.
00:15 Grizzly Adams: Welcome, Asado! I have been expecting you.
00:15 Asado [4169]: task
00:15 Grizzly Adams: There you can see the following tasks, please tell me the number of the task that you want to do.
00:15 Asado [4169]: rotworms
00:15 Grizzly Adams: Are you sure that do you want to start the task number 3? In this task you will need to defeat 20 Rotworms.
00:15 Asado [4169]: yes
00:15 Grizzly Adams: You have started the task number 3, remember... in this task you will need to defeat 20 Rotworms. Good luck!
00:15 Asado [4169]: report rotworms
00:15 Grizzly Adams: Current -1 Rotworms killed, you need to kill 20.
Killed em all.
and worked good
00:17 1 Rotworm defeated. Total [1/20] Rotworms.
00:17 2 Rotworm defeated. Total [2/20] Rotworms.
00:17 3 Rotworm defeated. Total [3/20] Rotworms.
00:17 4 Rotworm defeated. Total [4/20] Rotworms.
00:17 5 Rotworm defeated. Total [5/20] Rotworms.
00:17 6 Rotworm defeated. Total [6/20] Rotworms.
00:17 7 Rotworm defeated. Total [7/20] Rotworms.
00:17 8 Rotworm defeated. Total [8/20] Rotworms.
00:17 9 Rotworm defeated. Total [9/20] Rotworms.
00:17 10 Rotworm defeated. Total [10/20] Rotworms.
00:17 11 Rotworm defeated. Total [11/20] Rotworms.
00:17 12 Rotworm defeated. Total [12/20] Rotworms.
00:17 13 Rotworm defeated. Total [13/20] Rotworms.
00:17 14 Rotworm defeated. Total [14/20] Rotworms.
00:17 15 Rotworm defeated. Total [15/20] Rotworms.
00:17 16 Rotworm defeated. Total [16/20] Rotworms.
00:17 17 Rotworm defeated. Total [17/20] Rotworms.
00:17 18 Rotworm defeated. Total [18/20] Rotworms.
00:17 19 Rotworm defeated. Total [19/20] Rotworms.
00:17 20 Rotworm defeated. Total [20/20] Rotworms.
Tried to take it again that's what i find by completing the task without killing rotworms again
0:17 Asado [4169]: hi
00:17 Asado [4169]: report rotworms
00:17 Grizzly Adams: Great!... you have finished the task number 3. Good job.
00:17 Asado [4169]: report rotworms
00:17 Grizzly Adams: You already finished this task.
00:18 Asado [4169]: tasks
00:18 Grizzly Adams: There you can see the following tasks, please tell me the number of the task that you want to do.
00:18 Asado [4169]: rotworms
00:18 Grizzly Adams: You already finished this task.
00:18 Grizzly Adams: Are you sure that do you want to start the task number 3? In this task you will need to defeat 20 Rotworms.
00:18 Asado [4169]: yes
00:18 Grizzly Adams: You have started the task number 3, remember... in this task you will need to defeat 20 Rotworms. Good luck!
00:18 Asado [4169]: report rotworms
00:18 Grizzly Adams: Great!... you have finished the task number 3. Good job.
00:18 Asado [4169]: rotworms
00:18 Grizzly Adams: You already finished this task.
00:18 Grizzly Adams: Are you sure that do you want to start the task number 3? In this task you will need to defeat 20 Rotworms.
00:18 Asado [4169]: yes
00:18 Grizzly Adams: You have started the task number 3, remember... in this task you will need to defeat 20 Rotworms. Good luck!
00:18 Asado [4169]: report rotworms
00:18 Grizzly Adams: Great!... you have finished the task number 3. Good job.
Remember that i didn't kill any monster and i could take the reward easily
Tried to take the reward again from monsters like trolls but i found this
00:20 Asado [4169]: hi
00:20 Asado [4169]: trolls
00:20 Grizzly Adams: Are you sure that do you want to start the task number 1? In this task you will need to defeat 100 Trolls.
00:20 Asado [4169]: yes
00:20 Grizzly Adams: You have started the task number 1, remember... in this task you will need to defeat 100 Trolls. Good luck!
00:20 Asado [4169]: report trolls
00:20 Grizzly Adams: Current -1 Trolls killed, you need to kill 100.
00:20 Asado [4169]: report
00:20 Grizzly Adams: You are currently making this task:
Name: Trolls Kills: 0 - 100.
Please say report and the name of the task that do you want to report, example: 'Report Trolls'.
00:20 Asado [4169]: report trolls
00:20 Grizzly Adams: Current 0 Trolls killed, you need to kill 100.
I should kill em all then i can take the reward many times as i can by the same way of kill them for first time then take reward
 
I am focusing a problem with the npc.
00:15 Grizzly Adams: Welcome, Asado! I have been expecting you.
00:15 Asado [4169]: task
00:15 Grizzly Adams: There you can see the following tasks, please tell me the number of the task that you want to do.
00:15 Asado [4169]: rotworms
00:15 Grizzly Adams: Are you sure that do you want to start the task number 3? In this task you will need to defeat 20 Rotworms.
00:15 Asado [4169]: yes
00:15 Grizzly Adams: You have started the task number 3, remember... in this task you will need to defeat 20 Rotworms. Good luck!
00:15 Asado [4169]: report rotworms
00:15 Grizzly Adams: Current -1 Rotworms killed, you need to kill 20.
Killed em all.
and worked good
00:17 1 Rotworm defeated. Total [1/20] Rotworms.
00:17 2 Rotworm defeated. Total [2/20] Rotworms.
00:17 3 Rotworm defeated. Total [3/20] Rotworms.
00:17 4 Rotworm defeated. Total [4/20] Rotworms.
00:17 5 Rotworm defeated. Total [5/20] Rotworms.
00:17 6 Rotworm defeated. Total [6/20] Rotworms.
00:17 7 Rotworm defeated. Total [7/20] Rotworms.
00:17 8 Rotworm defeated. Total [8/20] Rotworms.
00:17 9 Rotworm defeated. Total [9/20] Rotworms.
00:17 10 Rotworm defeated. Total [10/20] Rotworms.
00:17 11 Rotworm defeated. Total [11/20] Rotworms.
00:17 12 Rotworm defeated. Total [12/20] Rotworms.
00:17 13 Rotworm defeated. Total [13/20] Rotworms.
00:17 14 Rotworm defeated. Total [14/20] Rotworms.
00:17 15 Rotworm defeated. Total [15/20] Rotworms.
00:17 16 Rotworm defeated. Total [16/20] Rotworms.
00:17 17 Rotworm defeated. Total [17/20] Rotworms.
00:17 18 Rotworm defeated. Total [18/20] Rotworms.
00:17 19 Rotworm defeated. Total [19/20] Rotworms.
00:17 20 Rotworm defeated. Total [20/20] Rotworms.
Tried to take it again that's what i find by completing the task without killing rotworms again
0:17 Asado [4169]: hi
00:17 Asado [4169]: report rotworms
00:17 Grizzly Adams: Great!... you have finished the task number 3. Good job.
00:17 Asado [4169]: report rotworms
00:17 Grizzly Adams: You already finished this task.
00:18 Asado [4169]: tasks
00:18 Grizzly Adams: There you can see the following tasks, please tell me the number of the task that you want to do.
00:18 Asado [4169]: rotworms
00:18 Grizzly Adams: You already finished this task.
00:18 Grizzly Adams: Are you sure that do you want to start the task number 3? In this task you will need to defeat 20 Rotworms.
00:18 Asado [4169]: yes
00:18 Grizzly Adams: You have started the task number 3, remember... in this task you will need to defeat 20 Rotworms. Good luck!
00:18 Asado [4169]: report rotworms
00:18 Grizzly Adams: Great!... you have finished the task number 3. Good job.
00:18 Asado [4169]: rotworms
00:18 Grizzly Adams: You already finished this task.
00:18 Grizzly Adams: Are you sure that do you want to start the task number 3? In this task you will need to defeat 20 Rotworms.
00:18 Asado [4169]: yes
00:18 Grizzly Adams: You have started the task number 3, remember... in this task you will need to defeat 20 Rotworms. Good luck!
00:18 Asado [4169]: report rotworms
00:18 Grizzly Adams: Great!... you have finished the task number 3. Good job.
Remember that i didn't kill any monster and i could take the reward easily
Tried to take the reward again from monsters like trolls but i found this
00:20 Asado [4169]: hi
00:20 Asado [4169]: trolls
00:20 Grizzly Adams: Are you sure that do you want to start the task number 1? In this task you will need to defeat 100 Trolls.
00:20 Asado [4169]: yes
00:20 Grizzly Adams: You have started the task number 1, remember... in this task you will need to defeat 100 Trolls. Good luck!
00:20 Asado [4169]: report trolls
00:20 Grizzly Adams: Current -1 Trolls killed, you need to kill 100.
00:20 Asado [4169]: report
00:20 Grizzly Adams: You are currently making this task:
Name: Trolls Kills: 0 - 100.
Please say report and the name of the task that do you want to report, example: 'Report Trolls'.
00:20 Asado [4169]: report trolls
00:20 Grizzly Adams: Current 0 Trolls killed, you need to kill 100.
I should kill em all then i can take the reward many times as i can by the same way of kill them for first time then take reward
Under:
PHP:
doCreatureSetStorage(cid, tasks[choose[cid]].questStarted, 1)
Add:
PHP:
doCreatureSetStorage(cid, tasks[choose[cid]].questStorage, 0)
 
Under:
PHP:
doCreatureSetStorage(cid, tasks[choose[cid]].questStarted, 1)
Add:
PHP:
doCreatureSetStorage(cid, tasks[choose[cid]].questStorage, 0)
Worked fine, But there is something more. I wanna take only 1 task every time for ex. if i have Task 1 then i can't take task 2 until i finish task 1
 
Worked fine, But there is something more. I wanna take only 1 task every time for ex. if i have Task 1 then i can't take task 2 until i finish task 1
Above:
PHP:
if tasks[msg].level and getPlayerLevel(cid) < tasks[msg].level then
Paste:
PHP:
local startedTasks = getTasksStarted(cid)
if #startedTasks > 0 then
    selfSay("You already started " .. tasks[startedTasks[1]].raceName .. " task. You cannot start more then one task at once.", cid)
    talkState[talkUser] = 0
    return true
end
 
Above:
PHP:
if tasks[msg].level and getPlayerLevel(cid) < tasks[msg].level then
Paste:
PHP:
local startedTasks = getTasksStarted(cid)
if #startedTasks > 0 then
    selfSay("You already started " .. tasks[startedTasks[1]].raceName .. " task. You cannot start more then one task at once.", cid)
    talkState[talkUser] = 0
    return true
end
Last one, Is it possible to cancel the mission by cancel word for for ex.?
 
Last one, Is it possible to cancel the mission by cancel word for for ex.?
Above:
PHP:
elseif msg:lower() == "report" then
Add:
PHP:
elseif msg:lower() == "cancel" then
   local startedTasks = getTasksStarted(cid)

   if #startedTasks == 0 then
      selfSay("You don't have any task started.", cid)
      talkState[talkUser] = 0
      return true
   end

   selfSay("Do you want to cancel " .. tasks[startedTasks[1]].raceName .. " task? Are you sure?", cid)
   talkState[talkUser] = 2
   return true

elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then
   local startedTasks = getTasksStarted(cid)

   if #startedTasks == 0 then
      selfSay("You don't have any task started.", cid)
      talkState[talkUser] = 0
      return true
   end

   doCreatureSetStorage(cid, tasks[startedTasks[1]].questStarted, -1)
   doCreatureSetStorage(cid, tasks[startedTasks[1]].questStorage, -1)
   selfSay("Task " .. tasks[startedTasks[1]].raceName .. " cancelled. Now you can choose other task.", cid)
   talkState[talkUser] = 0
   return true
 
hi everyone, can someone help me with this? this error appears on console when i start a task after talking to npc, its working but errors produce lag o_O

npc error.png

my npc script with Gesior fix requested by Activity:

Lua:
local THESNAPPER_POSITION = {x = 100, y = 100, z = 7}
local HIDE_POSITION = {x = 100, y = 100, z = 7}
local THEBLOODTUSK_POSITION = {x = 100, y = 100, z = 7}
local SHARDHEAD_POSITION = {x = 100, y = 100, z = 7}
local THUL_POSITION = {x = 100, y = 100, z = 7}
local ESMERALDA_POSITION = {x = 100, y = 100, z = 7}
local THEOLDWIDOW_POSITION = {x = 100, y = 100, z = 7}
local THEMANY_POSITION = {x = 100, y = 100, z = 7}
local LEVIATHAN_POSITION = {x = 100, y = 100, z = 7}
local STONECRACKER_POSITION = {x = 100, y = 100, z = 7}
local THENOXIUSSPAWN_POSITION = {x = 100, y = 100, z = 7}
local MERIKHTHESLAUGHTERER_POSITION = {x = 100, y = 100, z = 7}
local FAHIMTHEWISE_POSITION = {x = 100, y = 100, z = 7}
local RANDOMPIRATEBOSS_POSITION = {x = 100, y = 100, z = 7}
local THEHORNEDFOX_POSITION = {x = 100, y = 100, z = 7}
local NECROPHARUS_POSITION = {x = 100, y = 100, z = 7}


local tasks = {
    [1] = {questStarted = 1510, questStorage = 65000, killsRequired = 100, raceName = "Trolls", rewards = {{enable = true, type = "exp", values = 200}, {enable = true, type = "money", values = 200}}},
    [2] = {questStarted = 1511, questStorage = 65001, killsRequired = 150, raceName = "Goblins", rewards = {{enable = true, type = "exp", values = 300}, {enable = true, type = "money", values = 250}}},
    [3] = {questStarted = 1512, questStorage = 65002, killsRequired = 300, raceName = "Rotworms", rewards = {{enable = true, type = "exp", values = 1000}, {enable = true, type = "money", values = 400}}},
    [4] = {questStarted = 1513, questStorage = 65003, killsRequired = 500, raceName = "Cyclops", rewards = {{enable = true, type = "exp", values = 3000}, {enable = true, type = "money", values = 800}}},
    [5] = {questStarted = 1514, questStorage = 65004, killsRequired = 300, raceName = "Crocodiles", rewards = {{enable = true, type = "exp", values = 800}, {enable = true, type = "boss", values = THESNAPPER_POSITION}, {enable = true, type = "points", values = 7}}},
    [6] = {questStarted = 1515, questStorage = 65005, killsRequired = 300, raceName = "Tarantulas", rewards = {{enable = true, type = "money", values = 1500}, {enable = true, type = "boss", values = HIDE_POSITION}, {enable = true, type = "points", values = 2}}},
    [7] = {questStarted = 1516, questStorage = 65006, killsRequired = 150, raceName = "Carniphilas", rewards = {{enable = true, type = "item", values = 2160,1}, {enable = false, type = "points", values = 1}}},
    [8] = {questStarted = 1517, questStorage = 65007, killsRequired = 200, raceName = "Stone Golems", rewards = {{enable = true, type = "exp", values = 2000}, {enable = true, type = "points", values = 1}}},
    [9] = {questStarted = 1518, questStorage = 65008, killsRequired = 300, raceName = "Mammoths", rewards = {{enable = true, type = "exp", values = 4000}, {enable = true, type = "item", values = 2160,1}}},
    [10] = {questStarted = 1519, questStorage = 65009, killsRequired = 300, raceName = "Ice Golems", rewards = {{enable = true, type = "exp", values = 15000}, {enable = true, type = "boss", values = SHARDHEAD_POSITION}, {enable = true, type = "points", values = 2}}},
    [11] = {questStarted = 1520, questStorage = 65010, killsRequired = 300, raceName = "Quaras Scout", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "points", values = 1}}},
    [12] = {questStarted = 1521, questStorage = 65011, killsRequired = 300, raceName = "Quaras", rewards = {{enable = true, type = "exp", values = 12000}, {enable = true, type = "boss", values = THUL_POSITION}, {enable = true, type = "points", values = 2}}},
    [13] = {questStarted = 1522, questStorage = 65012, killsRequired = 70, raceName = "Water Elementals", rewards = {{enable = true, type = "exp", values = 7000}, {enable = true, type = "points", values = 1}}},
    [14] = {questStarted = 1523, questStorage = 65013, killsRequired = 70, raceName = "Earth Elementals", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "points", values = 1}}},
    [15] = {questStarted = 1524, questStorage = 65014, killsRequired = 70, raceName = "Energy Elementals", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "points", values = 1}}},
    [16] = {questStarted = 1525, questStorage = 65015, killsRequired = 70, raceName = "Fire Elementals", rewards = {{enable = true, type = "exp", values = 7000}, {enable = true, type = "points", values = 1}}},
    [17] = {questStarted = 1526, questStorage = 65016, killsRequired = 200, raceName = "Mutated Rats", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "boss", values = ESMERALDA_POSITION}, {enable = true, type = "points", values = 2}}},
    [18] = {questStarted = 1527, questStorage = 65017, killsRequired = 500, raceName = "Giant Spiders", rewards = {{enable = true, type = "exp", values = 5000}, {enable = true, type = "boss", values = THEOLDWIDOW_POSITION}, {enable = true, type = "points", values = 2}}},
    [19] = {questStarted = 1528, questStorage = 65018, killsRequired = 2000, raceName = "Hydras", rewards = {{enable = true, type = "boss", values = THEMANY_POSITION}, {enable = true, type = "points", values = 4}}},
    [20] = {questStarted = 1529, questStorage = 65019, killsRequired = 2000, raceName = "Sea Serpents", rewards = {{enable = true, type = "boss", values = LEVIATHAN_POSITION}, {enable = true, type = "points", values = 4}}},
    [21] = {questStarted = 1530, questStorage = 65020, killsRequired = 2000, raceName = "Behemoths", rewards = {{enable = true, type = "boss", values = STONECRACKER_POSITION}, {enable = true, type = "points", values = 4}}},
    [22] = {questStarted = 1531, questStorage = 65021, killsRequired = 1500, raceName = "Serpents Spawn", rewards = {{enable = true, type = "teleport", values = THENOXIUSSPAWN_POSITION}, {enable = true, type = "points", values = 4}}},
    [23] = {questStarted = 1532, questStorage = 65022, killsRequired = 500, raceName = "Green Djinns", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "boss", values = MERIKHTHESLAUGHTERER_POSITION}}},
    [24] = {questStarted = 1533, questStorage = 65023, killsRequired = 500, raceName = "Blue Djinns", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "boss", values = FAHIMTHEWISE_POSITION}}},
    [25] = {questStarted = 1534, questStorage = 65024, killsRequired = 3000, raceName = "Pirates1", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "boss", values = RANDOMPIRATEBOSS_POSITION}}},
    [26] = {questStarted = 1535, questStorage = 65025, killsRequired = 3000, raceName = "Pirates2", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "money", values = 5000}}},
    [27] = {questStarted = 1536, questStorage = 65026, killsRequired = 5000, raceName = "Minotaurs", rewards = {{enable = true, type = "boss", values = THEHORNEDFOX_POSITION}}},
    [28] = {questStarted = 1537, questStorage = 65027, killsRequired = 4000, raceName = "Magicians1", rewards = {{enable = true, type = "boss", values = NECROPHARUS_POSITION}}},
    [29] = {questStarted = 1538, questStorage = 65028, killsRequired = 1000, raceName = "Magicians2", rewards = {{enable = true, type = "exp", values = 40000}}},
    [30] = {questStarted = 1539, questStorage = 65029, killsRequired = 6666, raceName = "Demons", rewards = {{enable = true, type = "storage", values = {65535, 1}}}}
}

local rankStorage = 32150
local choose = {}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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

function getTasksStarted(cid)
    local tmp = {}
    for k, v in pairs(tasks) do
        if getCreatureStorage(cid, v.questStarted) == 1 then
            table.insert(tmp, k)
        end
    end
    return tmp
end

function getTaskByName(name)
    for k, v in pairs(tasks) do
        if v.raceName:lower() == name:lower() then
            return k
        end
    end
    return false
end

function creatureSayCallback(cid, type, msg)

    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
    if isInArray({"task", "tasks"}, msg:lower()) then
        selfSay("There you can see the following tasks, please tell me the number of the task that you want to do.", cid)
        local text = ""
        for i = 1, table.maxn(tasks) do
            text = text .. (text == "" and "" or "\n") .. i .. " - " .. tasks.raceName .. (getCreatureStorage(cid, tasks.questStarted) == 1 and " [...]" or getCreatureStorage(cid, tasks.questStarted) == 2 and " [x]" or "")
        end
        return doShowTextDialog(cid, 5956, text)

    elseif getTaskByName(msg) or tasks[tonumber(msg)] then
        msg = (getTaskByName(msg) or tonumber(msg))
        if getCreatureStorage(cid, tasks[msg].questStarted) == 1 then
            selfSay("You already started this task.", cid)
            talkState[talkUser] = 0
            return true
        end
        if getCreatureStorage(cid, tasks[msg].questStarted) == 2 then
            selfSay("You already finished this task.", cid)
            talkState[talkUser] = 0
            return true
        end
        local startedTasks = getTasksStarted(cid)
        if #startedTasks > 0 then
        selfSay("You already started " .. tasks[startedTasks[1]].raceName .. " task. You cannot start more then one task at once.", cid)
        talkState[talkUser] = 0
        return true
        end
        if tasks[msg].level and getPlayerLevel(cid) < tasks[msg].level then
            selfSay("You need level " .. tasks[msg].level .. " or higher to make this task.", cid)
            talkState[talkUser] = 0
            return true
        end
        selfSay("Are you sure that do you want to start the task number " .. msg .. "? In this task you will need to defeat " .. tasks[msg].killsRequired .. " " .. tasks[msg].raceName .. ".", cid)
        choose[cid] = msg
        talkState[talkUser] = 1
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
        doCreatureSetStorage(cid, tasks[choose[cid]].questStarted, 1)
        doCreatureSetStorage(cid, tasks[choose[cid]].questStorage, 0)
        selfSay("You have started the task number " .. choose[cid] .. ", remember... in this task you will need to defeat " .. tasks[choose[cid]].killsRequired .. " " .. tasks[choose[cid]].raceName .. ". Good luck!", cid)
        talkState[talkUser] = 0
        return true
elseif msg:lower() == "cancel" then
   local startedTasks = getTasksStarted(cid)

   if #startedTasks == 0 then
      selfSay("You don't have any task started.", cid)
      talkState[talkUser] = 0
      return true
   end

   selfSay("Do you want to cancel " .. tasks[startedTasks[1]].raceName .. " task? Are you sure?", cid)
   talkState[talkUser] = 2
   return true

elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then
   local startedTasks = getTasksStarted(cid)

   if #startedTasks == 0 then
      selfSay("You don't have any task started.", cid)
      talkState[talkUser] = 0
      return true
   end

   doCreatureSetStorage(cid, tasks[startedTasks[1]].questStarted, -1)
   doCreatureSetStorage(cid, tasks[startedTasks[1]].questStorage, -1)
   selfSay("Task " .. tasks[startedTasks[1]].raceName .. " cancelled. Now you can choose other task.", cid)
   talkState[talkUser] = 0
   return true
    elseif msg:lower() == "report" then
        local t = getTasksStarted(cid)
        local response = "You are currently making " .. (#t > 1 and "these" or "this") .. " task" .. (#t > 1 and "s" or "") .. ":\n"
        if table.maxn(t) > 0 then
            for _, tsk in ipairs(t) do
                if getCreatureStorage(cid, tasks[tsk].questStorage) < 0 then
                    doCreatureSetStorage(cid, tasks[tsk].questStorage, 0)
                end
                response = response .. " Name: " .. tasks[tsk].raceName .. " Kills: " .. getCreatureStorage(cid, tasks[tsk].questStorage) .. " - " .. tasks[tsk].killsRequired .. ".\n"
            end
            response = response .. "Please say report and the name of the task that do you want to report, example: 'Report Trolls'."
            return selfSay(response, cid)
        else
            return selfSay("You need to start at least one task first.", cid)
        end
    elseif string.sub(msg:lower(), 0, 6) == "report" then
        local t = getTaskByName(string.sub(msg, 8, string.len(msg)))
        if not t then
            return selfSay("That task does not exists.", cid)
        end

        if getCreatureStorage(cid, tasks[t].questStarted) == 2 then
            return selfSay("You already finished this task.", cid)
        end

        if getCreatureStorage(cid, tasks[t].questStarted) < 1 then
            return selfSay("You don't have started this task.", cid)
        end

        if tasks[t].killsRequired > getCreatureStorage(cid, tasks[t].questStorage) then
            return selfSay("Current " .. getCreatureStorage(cid, tasks[t].questStorage) .. " " .. tasks[t].raceName .. " killed, you need to kill " .. tasks[t].killsRequired .. ".", cid)
        end

        for i = 1, table.maxn(tasks[t].rewards) do
            for k_, reward in pairs(tasks[t].rewards) do
                if(reward.enable) then
                    if isInArray({"boss", "teleport", 1}, reward.type) then
                        doTeleportThing(cid, reward.values)
                    elseif isInArray({"exp", "experience", 2}, reward.type) then
                        doPlayerAddExperience(cid, reward.values)
                    elseif isInArray({"item", 3}, reward.type) then
                        doPlayerAddItem(cid, reward.values[1], reward.values[2])
                    elseif isInArray({"money", 4}, reward.type) then
                        doPlayerAddMoney(cid, reward.values)
                    elseif isInArray({"storage", "stor", 5}, reward.type) then
                        doCreatureSetStorage(cid, reward.values[1], reward.values[2])
                    elseif isInArray({"points", "rank", 2}, reward.type) then
                        doCreatureSetStorage(cid, rankStorage, getCreatureStorage(cid, rankStorage) + reward.values)
                    else
                        print("[Warning - Npc::KillingInTheNameOf] Wrong reward type: " .. (reward.type or "nil") .. ", reward could not be loaded.")
                    end
                end
            end
        end
        local rank = getCreatureStorage(cid, rankStorage)
        selfSay("Great!... you have finished the task number " .. t .. "" .. (rank > 4 and ", you are a " or "") .. "" .. (((rank > 4 and rank < 10) and ("Huntsman") or (rank > 9 and rank < 20) and ("Ranger") or (rank > 19 and rank < 30) and ("Big Game Hunter") or (rank > 29 and rank < 50) and ("Trophy Hunter") or (rank > 49) and ("Elite Hunter")) or "") .. ". Good job.", cid)
        return doCreatureSetStorage(cid, tasks[t].questStarted, 2)
    end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
sorry i didnt read well, this will fix it

Try change: (in 123 line)
Code:
       for i = 1, table.maxn(tasks) do
           text = text .. (text == "" and "" or "\n") .. i .. " - " .. tasks.raceName .. (getCreatureStorage(cid, tasks.questStarted) == 1 and " [...]" or getCreatureStorage(cid, tasks.questStarted) == 2 and " [x]" or "")
       end

To:
Code:
       for i = 1, table.maxn(tasks) do
           text = text .. (text == "" and "" or "\n") .. i .. " - " .. tasks[i].raceName .. (getCreatureStorage(cid, tasks[i].questStarted) == 1 and " [...]" or getCreatureStorage(cid, tasks[i].questStarted) == 2 and " [x]" or "")
       end
 
Back
Top