Postado Abril 9, 2022 3 anos Boa tarde, estou com uma script de task, mais esta esta bugando as vezes, tem hora que voce vai estrega uma task, e em vez de pula para o proximo mostro, continua no mesmo ai da para ficar entregando sem parar, se alguem poder me ajuda agradeço. Citar domodlib('task_func') 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 creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser,msg, str,rst = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower(),"","" local task,daily, hours = getTaskMission(cid),getDailyTaskMission(cid), 24 if isInArray({"task","tasks","missao","mission"}, msg) then if task_sys[task] then if getPlayerStorageValue(cid, task_sys[task].start) <= 0 then if getPlayerLevel(cid) >= task_sys[task].level then setPlayerStorageValue(cid, task_sys[task].start, 1) npcHandler:say("[Task System] Parabens, agora voce esta participando da Task do "..task_sys[task].name.." e devera matar "..task_sys[task].count.." desta lista: "..getMonsterFromList(task_sys[task].monsters_list)..". "..(#task_sys[task].items > 0 and "Ah e por favor me traga "..getItemsFromList(task_sys[task].items).." para mim." or "").."" , cid) else npcHandler:say("Desculpe, Mas voce precisa alcançar level "..task_sys[task].level.." para poder participar da Task dos "..task_sys[task].name.."!", cid) end else npcHandler:say("Desculpe, Mas voce atualmente esta na task "..task_sys[task].name..". Voce pode {entregar} caso ja tenha terminado.", cid) end else npcHandler:say("Desculpe, Mas por enquanto nao tenho mais nenhuma task para voce!", cid) end elseif isInArray({"meucufixoa"}, msg) then if getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() > 0 then npcHandler:say("Desculpe, voce deve esperar ate "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).." para iniciar uma nova task diaria!", cid) return true elseif daily_task[daily] and getPlayerStorageValue(cid, task_sys_storages[5]) >= daily_task[daily].count then npcHandler:say("Desculpe, voce tem task para {entregar} !", cid) return true end local r = doRandomDailyTask(cid) if r == 0 then npcHandler:say("Desculpe, mas voce nao tem level para completar nenhuma Task diaria.", cid) return true end setPlayerStorageValue(cid, task_sys_storages[4], r) setPlayerStorageValue(cid, task_sys_storages[6], os.time()+hours*3600) setPlayerStorageValue(cid, task_sys_storages[7], 1) setPlayerStorageValue(cid, task_sys_storages[5], 0) local dtask = daily_task[r] npcHandler:say("[Daily Task System] Parabens, agora voce esta participando da Task Diaria do "..dtask.name.." e devera matar "..dtask.count.." monstros desta lista: "..getMonsterFromList(dtask.monsters_list).." ate "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6]))..". Boa sorte!" , cid) elseif isInArray({"receber","reward","recompensa","report","reportar","entregar","entrega"}, msg) then local v, k = task_sys[task], daily_task[daily] if v then -- original task if getPlayerStorageValue(cid, v.start) > 0 then if getPlayerStorageValue(cid,task_sys_storages[3]) >= v.count then if #v.items > 0 and not doRemoveItemsFromList(cid, v.items) then npcHandler:say("Desculpe, Mas voce tambem precisa entregar os itens desta lista: "..getItemsFromList(v.items), cid) return true end if v.exp > 0 then doPlayerAddExp(cid, v.exp) str = str.."".. (str == "" and "" or ", ") .." "..v.exp.." de exp" end if v.money > 0 then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ", ") ..""..v.money.." gps" end if table.maxn(v.reward) > 0 then GiveRewardsTask(cid, v.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(v.reward) end local graduacao = getPlayerStorageValue(cid, GRADUACAO_STORAGE) setPlayerStorageValue(cid, GRADUACAO_STORAGE, graduacao+2) npcHandler:say("Voce recebeu dois pontos de graduacao.", cid) if getPlayerGuildId(cid) > 0 then if v.points > 0 then guildEventPoints(cid, getPlayerGuildId(cid), v.points) playerGuildPoints(cid, getPlayerName(cid)) local Info = checarGuildPoints(cid, getPlayerGuildId(cid)) local Points = Info:getDataInt("event_points") npcHandler:say("Sua guild recebeu um Ponto. Atualmente sua guild se encontra com: "..Points.." pontos.", cid) end end npcHandler:say("Obrigado pela sua ajuda Recompensas: "..(str == "" and "nenhuma" or ""..str.."").." por ter completado a task do "..v.name, cid) setPlayerStorageValue(cid, task_sys_storages[3], 0) setPlayerStorageValue(cid, task_sys_storages[1], (task+1)) else npcHandler:say("Desculpe, Mas voce ainda nao terminou a sua task do "..v.name..". Preciso que mate mais "..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and v.count or -(getPlayerStorageValue(cid,task_sys_storages[3])-v.count)).." Destes monstros terriveis!", cid) end end end elseif msg == "no" then selfSay("Tudo bem entao", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Você tem o código disponível? Se tiver publique-o aqui: Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.
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.