Postado Maio 30, 2018 7 anos Diga em poucas palavras a base utilizada (Nome do servidor ou nome do website). Ex. TFS 1.3; Base: PokexCyan Qual erro está surgindo/O que você procura? Eu pego a task no npc, ai eu vou entregar a task, entreguei normal, so que o npc nao finaliza a task eu posso fazer ela qnts vezes eu quiser. Se alguem poder ajudar ai agradeço Dou REP++ Você tem o código disponível? Se tiver publique-o aqui: 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 = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid msg = string.lower(msg) --------- local need = { {id = 12184, qt = 10}, --karp fin } local rewards = { {id = 2152, qt = 10}, --money } local stoFinish = 92087 --------- if msgcontains(msg, 'task') or msgcontains(msg, 'ajuda') then if getPlayerStorageValue(cid, stoFinish) >= 1 then selfSay("Sorry, you already had done this quest.", cid) talkState[talkUser] = 0 return true end selfSay("Hello my friend, can you bring to me: 200 magikarp fin? I will reward you!",cid) talkState[talkUser] = 1 return true elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') and talkState[talkUser] == 1 then if getPlayerItemCount(cid, need[1].id) < need[1].qt then selfSay("You don't brought to me all the items what i asked for...", cid) selfSay("Remember, you need to bring to me 200 magikarp fin...", cid) talkState[talkUser] = 0 return true end for i = 1, #need do doPlayerRemoveItem(cid, need.id, need.qt) end for i = 1, #rewards do doPlayerAddItem(cid, rewards.id, rewards.qt) doPlayerAddExperience(cid, 150000) end selfSay("thanks you, bye!", cid) setPlayerStorageValue(cid, stoFinish, 1) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Maio 30, 2018 7 anos Solução 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 = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid msg = string.lower(msg) --------- local need = { {id = 12184, qt = 10}, --karp fin } local rewards = { {id = 2152, qt = 10}, --money } local stoFinish = 92087 --------- if msgcontains(msg, 'task') or msgcontains(msg, 'ajuda') then if getPlayerStorageValue(cid, stoFinish) >= 1 then selfSay("Sorry, you already had done this quest.", cid) talkState[talkUser] = 0 return true end if getPlayerStorageValue(cid, stoFinish) == -1 then selfSay("Hello my friend, can you bring to me: 200 magikarp fin? I will reward you!",cid) talkState[talkUser] = 1 return true end elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') and talkState[talkUser] == 1 then if getPlayerItemCount(cid, need[1].id) < need[1].qt then selfSay("You don't brought to me all the items what i asked for...", cid) selfSay("Remember, you need to bring to me 200 magikarp fin...", cid) talkState[talkUser] = 0 return true end for i = 1, #need do doPlayerRemoveItem(cid, need.id, need.qt) end for i = 1, #rewards do doPlayerAddItem(cid, rewards.id, rewards.qt) doPlayerAddExperience(cid, 150000) end selfSay("thanks you, bye!", cid) setPlayerStorageValue(cid, stoFinish, 1) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
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.