Postado Outubro 15, 2017 7 anos 22 horas atrás, Weslley Kiyo disse: 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 onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) if msgcontains(msg, 'mission1') or msgcontains(msg, 'mission 1') then npcHandler:say('TEXT MISSION 1!',cid) npcHandler.topic[cid] = 1 elseif msgcontains(msg, 'mission2') or msgcontains(msg, 'mission 2') then npcHandler:say('TEXT MISSION 2!',cid) npcHandler.topic[cid] = 2 ------------------------------------------------------------------------------------ elseif msgcontains(msg, 'yes') then if npcHandler.topic[cid] == 1 then if getPlayerItemCount(cid, 2559) >= 1 then -- small axe if doPlayerRemoveItem(cid, 2559, 1) then -- small axe doPlayerAddItem(cid, 2553, 1) -- pick npcHandler:say('Splendid! Here, take your pick.', cid) npcHandler.topic[cid] = 0 else doPlayerSendTextMessage(cid,25,"ERROR! Please contact the administrator.") npcHandler.topic[cid] = 0 end else npcHandler:say('Sorry, I am looking for a small axe.', cid) npcHandler.topic[cid] = 0 end elseif npcHandler.topic[cid] == 2 then if getPlayerItemCount(cid, 2559) >= 1 then -- small axe if doPlayerRemoveItem(cid, 2559, 1) then -- small axe doPlayerAddItem(cid, 2553, 1) -- pick npcHandler:say('Splendid! Here, take your pick.', cid) npcHandler.topic[cid] = 0 else doPlayerSendTextMessage(cid,25,"ERROR! Please contact the administrator.") npcHandler.topic[cid] = 0 end else npcHandler:say('Sorry, I am looking for a small axe.', cid) npcHandler.topic[cid] = 0 end end elseif(msgcontains(msg, "no") and isInArray({1,2}, npcHandler.topic[cid])) then npcHandler:say("Ok then.", cid) npcHandler.topic[cid] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Eu uso dessa maneira em meu servidor. Aproveita e dá uma conferida lá OBS: O script foi feito para versão 0.3.7, porém funciona em tfs 1.x Otimo, vou testar aqui... caso eu queira adicionar mais e so fazer elseif? e tipo pode me dar uma explicação rapida desta quest que vc postou ai? Editado Outubro 15, 2017 7 anos por Everson Miranda (veja o histórico de edições)
Postado Outubro 15, 2017 7 anos 32 minutos atrás, Everson Miranda disse: Otimo, vou testar aqui... caso eu queira adicionar mais e so fazer elseif? e tipo pode me dar uma explicação rapida desta quest que vc postou ai? Sim! Claro, só falar
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.