• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

help with error console on task npc

wafuboe

Active Member
Joined
Dec 24, 2010
Messages
884
Solutions
2
Reaction score
26
well i was installing this task system npc but when i ask for a task list it give methis error on console and nothing happens imusing otx 3.10 tfs 1.2
34962
script
task system.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)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

npcHandler:addModule(FocusModule:new())

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, 'normal') then
 npcHandler:say("Great. Which monster task would you like to do? ?", cid)
 npcHandler.topic[cid] = 1
elseif npcHandler.topic[cid] == 1 then
for mon, l in pairs(task_monsters) do
 if player:getStorageValue(task_sto_time) < os.time() then
  if player:getStorageValue(task_storage) == -1 then
   if msg == l.nome then
     npcHandler:say("Very well, you are now doing the task of {"..l.nome:gsub("^%l", string.upper).."}, you need to kill "..l.amount.."Good luck!", cid)
     player:setStorageValue(task_storage, mon)
     player:setStorageValue(l.storage, 0)
     npcHandler.topic[cid] = 0
     npcHandler:releaseFocus(cid)
   break
   else
     npcHandler:say("Sorry, we do not have this task.", cid)
     npcHandler.topic[cid] = 0
   end
  else
   npcHandler:say("You are already doing a task. You can only do one at a time. Say {! Task} to see information about your current task.", cid)
   npcHandler.topic[cid] = 0
  end
 else
  npcHandler:say("I'm not looking forward to giving you any assignments, because you abandoned the previous one. Wait 2 hours for punishment to end.", cid)
  npcHandler.topic[cid] = 0
 end
end
------------------------------------------------------------------
------------------------------------------------------------------
elseif npcHandler.topic[cid] == 0 and msgcontains(msg, 'daily') then
 if player:getStorageValue(time_daySto) < os.time() then
  npcHandler:say("Remember, it is of great importance that the daily tasks are done. Now tell me, the task of which monster you would like to do ?", cid)
  npcHandler.topic[cid] = 2
else
  npcHandler:say('You have completed today daily task, expect to spend 24 hours to do it again.', cid)
  npcHandler:releaseFocus(cid)
end
elseif npcHandler.topic[cid] == 2 then
for mon, l in pairs(task_daily) do
 if player:getStorageValue(task_sto_time) < os.time() then
  if player:getStorageValue(taskd_storage) == -1 then
   if msg == l.nome then
    npcHandler:say("Very well, you are now doing the daily task of {"..l.nome:gsub("^%l", string.upper).."}, you need to kill "..l.amount.."  Good luck!", cid)
    player:setStorageValue(taskd_storage, mon)
    player:setStorageValue(l.storage, 0)
    npcHandler.topic[cid] = 0
    npcHandler:releaseFocus(cid)
   break
   else
    npcHandler:say("Sorry, we do not have this daily task.", cid)
    npcHandler.topic[cid] = 0
   end
  else
   npcHandler:say("You are already doing a daily task. You can only do one per day. Say {! Task} to see information about your current task.", cid)
   npcHandler.topic[cid] = 0
  end
 else
  npcHandler:say("I'm not looking forward to giving you any assignments, because you abandoned the previous one. Wait 2 hours for punishment to end.", cid)
  npcHandler.topic[cid] = 0
 end
end
------------------------------------------------------------------
------------------------------------------------------------------
elseif msgcontains(msg, 'report') then
 if npcHandler.topic[cid] == 0 then
  npcHandler:say("What kind of task did you finish, {normal} or {daily}?", cid)
  npcHandler.topic[cid] = 3
 end
elseif npcHandler.topic[cid] == 3 then
if msgcontains(msg, 'normal') then
 if getTaskInfos(player) then
  if player:getStorageValue(getTaskInfos(player).storage) == getTaskInfos(player).amount then
    local pt1 = getTaskInfos(player).pointsTask[1]
    local pt2 = getTaskInfos(player).pointsTask[2]
    local txt = ' '..(pt1 > 1 and pt1..' task points' or pt1 <= 1 and pt1..' task points')..' e '..(pt2 > 1 and pt2..' rank points' or pt2 <= 1 and pt2..' rank points')..', '
    if #getItemsFromTable(getTaskInfos(player).items) > 0 then
    txt = txt..'besides winning: '..getItemsFromTable(getTaskInfos(player).items)..', '
    for g = 1, #getTaskInfos(player).items do
     player:addItem(getTaskInfos(player).items[g].id, getTaskInfos(player).items[g].count)
    end
    end
    local exp = getTaskInfos(player).exp
    if exp > 0 then
    txt = txt..'Ill give it to you too. '..exp..' of experience, '
    player:addExperience(exp)
    end
    taskPoints_add(player, pt1)
    taskRank_add(player, pt2)
    player:setStorageValue(getTaskInfos(player).storage, -1)
    player:setStorageValue(task_storage, -1)
    npcHandler:say(txt..'Thank you again and see you again!', cid)
    npcHandler.topic[cid] = 0
    npcHandler:releaseFocus(cid)
  else
    npcHandler:say('You have not finished your current task yet. You will receive it when you finish.', cid)
    npcHandler.topic[cid] = 0
    npcHandler:releaseFocus(cid)
  end
 else
  npcHandler:say('You are not doing any task.', cid)
  npcHandler.topic[cid] = 0
  npcHandler:releaseFocus(cid)
 end
elseif npcHandler.topic[cid] == 3 and msgcontains(msg, 'daily') then
if player:getStorageValue(time_daySto)-os.time() <= 0 then
if getTaskDailyInfo(player) then
 if player:getStorageValue(getTaskDailyInfo(player).storage) == getTaskDailyInfo(player).amount then
    local pt1 = getTaskDailyInfo(player).pointsTask[1]
    local pt2 = getTaskDailyInfo(player).pointsTask[2]
    local txt = 'Thanks for doing the task, your awards are:'..(pt1 > 1 and pt1..' task points' or pt1 <= 1 and pt1..' task points')..' e '..(pt2 > 1 and pt2..'rank points ' or pt2 <= 1 and pt2..'rank points')..', '
 
    if #getTaskDailyInfo(player).items > 0 then
    txt = txt..'besides winning:: '..getItemsFromTable(getTaskDailyInfo(player).items)..', '
    for g = 1, #getTaskDailyInfo(player).items do
     player:addItem(getTaskDailyInfo(player).items[g].id, getTaskDailyInfo(player).items[g].count)
    end
    end
    local exp = getTaskDailyInfo(player).exp
    if exp > 0 then
    txt = txt..'Ill give it to you too. '..exp..' of experience, '
    player:addExperience(exp)
    end
    npcHandler:say(txt..' Thank you again and see you tomorrow !!', cid)
    taskPoints_add(player, pt1)
    taskRank_add(player, pt2)
    player:setStorageValue(getTaskDailyInfo(player).storage, -1)
    player:setStorageValue(taskd_storage, -1)
    player:setStorageValue(time_daySto, 1*60*60*24+os.time())
    npcHandler.topic[cid] = 0
    npcHandler:releaseFocus(cid)
 else
    npcHandler:say('You have not finished your current task yet. You will receive it when you finish.', cid)
    npcHandler.topic[cid] = 0
    npcHandler:releaseFocus(cid)
 end
else
 npcHandler:say('You are not doing any daily tasks.', cid)
 npcHandler.topic[cid] = 0
 npcHandler:releaseFocus(cid)
end
else
 npcHandler:say('You have already done a daily task, wait 24 hours to do another one again.', cid)
 npcHandler.topic[cid] = 0
 npcHandler:releaseFocus(cid)
end
end
------------------------------------------------------------------
------------------------------------------------------------------
elseif msgcontains(msg, 'abandon') then
if npcHandler.topic[cid] == 0 then
  npcHandler:say("What kind of task do you want to abandon, {normal} or {daily}?", cid)
  npcHandler.topic[cid] = 4
end
elseif npcHandler.topic[cid] == 4 and msgcontains(msg, 'normal') then
if getTaskInfos(player) then
   npcHandler:say('Unfortunate this situation, had faith that you would bring me this mission made, more was wrong. As punishment will be 2 hours without being able to do any task.', cid)
   player:setStorageValue(task_sto_time, os.time()+task_time*60*60)
   player:setStorageValue(getTaskInfos(player).storage, -1)
   player:setStorageValue(task_storage, -1)
   npcHandler:releaseFocus(cid)
else
  npcHandler:say('You are not doing any task to be able to abandon it.', cid)
  npcHandler:releaseFocus(cid)
end
elseif npcHandler.topic[cid] == 4 and msgcontains(msg, 'daily') then
if getTaskDailyInfo(player) then
   npcHandler:say('Unfortunate this situation, had faith that you would bring me this mission made, more was wrong. As punishment will be 2 hours without being able to do any task.', cid)
   player:setStorageValue(task_sto_time, os.time()+task_time*60*60)
   player:setStorageValue(getTaskDailyInfo(player).storage, -1)
   player:setStorageValue(taskd_storage, -1)
   npcHandler:releaseFocus(cid)
else
  npcHandler:say('You are not doing any daily tasks to be able to abandon it.', cid)
  npcHandler:releaseFocus(cid)
end
------------------------------------------------------------------
------------------------------------------------------------------
elseif msgcontains(msg, "common task list") then
local text = "----**| -> Tasks Normal <- |**----\n\n"
 for _, d in pairs(task_monsters) do
  text = text .."------ [*] "..d.nome.." [*] ------ \n[+] Amount [+] -> ["..(player:getStorageValue(d.storage) + 1).."/"..d.amount.."]:\n[+] Prizes [+] ->  "..(#d.items > 1 and getItemsFromTable(d.items).." - " or "")..""..d.exp.." experience \n\n"
 end
player:showTextDialog(1949, "" .. text)
npcHandler:say("Here is the list of normal task's.", cid)
------------------------------------------------------------------
------------------------------------------------------------------
elseif msgcontains(msg, "day task list") then
local text = "----**| -> Tasks Dailys <- |**----\n\n"
 for _, d in pairs(task_daily) do
  text = text .."------ [*] "..d.nome.." [*] ------ \n[+] Amount [+] -> ["..(player:getStorageValue(d.storage) + 1).."/"..d.amount.."]:\n[+] Prizes [+] ->  "..(#d.items > 1 and getItemsFromTable(d.items).." - " or "")..""..d.exp.." experience \n\n"
 end
player:showTextDialog(1949, "" .. text)
npcHandler:say("Here is a daily task's list.", cid)
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)


thank you so much!
 
Back
Top