Postado Janeiro 31, 2015 10 anos Eai pessoal, bom eu tentei fazer um npc é claro consegui como sempre(SOQUENÃO), bom ele era pra funcionar assim. Hi - Torre = O codigo checava se o player tem revive, caso ele não tenha prosiga caso contrario retorna uma mensagem informando que não pode entrar com revive. Yes = Se for entre 17:00:00 e 18:30:00 o player é teleportado para um certo local alem de ganhar tal item, porem tbm ele remove 10000000 de money equivalente a 10td. Porem ele não faz as funções que esta planejada, porfavor gostaria de saber em que parte errei Obrigado e Rep+ 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 local tele = {x = 1300, y = 131, z = 7} local revive = 12344 if msgcontains(msg, 'torre') or msgcontains(msg, 'Torre') then if getPlayerItemCount(cid, revive) >= 1 then selfSay('Voce nao Pode entrar no torneio com {revives}, por favor leve potions.', cid) return true end selfSay('Para entrar na torre pokemon vai custar 10td, deseja entrar?', cid) talkState[talkUser] = 2 elseif talkState[talkUser] == 2 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") > "17:00:00" or os.date("%X") < "18:30:00" then selfSay('As Inscrisoes para a torre pokemon terminaram, volte mais tarde', cid) else doTeleportThing(cid, tele) doPlayerAddItem(cid, revive, 30) doPlayerRemoveMoney(cid, 10000000) return true end else selfSay('Certeza que voce não quer Participar?Ok, ate a Proxima', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Janeiro 31, 2015 10 anos por kttallan (veja o histórico de edições)
Postado Janeiro 31, 2015 10 anos Solução Segue: local tele = {x = 1300, y = 131, z = 7} local revive = 12344 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 if msgcontains(msg, 'torre') or msgcontains(msg, 'Torre') then if getPlayerItemCount(cid, revive) >= 1 then selfSay('Voce nao Pode entrar no torneio com {revives}, por favor leve potions.', cid) return true end selfSay('Para entrar na torre pokemon vai custar 10td, deseja entrar?', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') and talkState[talkUser] == 1 then if os.date("%X") >= "15:00:00" and os.date("%X") <= "15:10:00" then if doPlayerRemoveMoney(cid, 10000000) then doTeleportThing(cid, tele) doPlayerAddItem(cid, revive, 30) else selfSay("Voce precisa ter 10td's para entrar.", cid) end else selfSay('As Inscricoes para a torre pokemon terminaram, volte mais tarde', cid) end end talkState[talkUser] = 0 return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Fevereiro 1, 2015 10 anos por Bruno Minervino (veja o histórico de edições) Atenciosamente, Bruno Minervino
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.