Postado Agosto 18, 2017 7 anos Autor 6 horas atrás, Alexy Brocanello disse: tome :D 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, 'torneio') then if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then selfSay('Você não pode entrar no torneio portando revives.', cid) return true end if getPlayerLevel(cid) >= 150 then selfSay('Desculpa, apenas players level 150- podem ir no torneio de Johto!', cid) return true end selfSay('Para entrar no torneio tem que pagar 20 hundred dollars, vai entrar?', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneiolukas.startHour1 or os.date("%X") > torneiolukas.endHour1 then if os.date("%X") < torneiolukas.startHour2 or os.date("%X") > torneiolukas.endHour2 then if os.date("%X") < torneiolukas.startHour3 or os.date("%X") > torneiolukas.endHour3 then if os.date("%X") < torneiolukas.startHour4 or os.date("%X") > torneiolukas.endHour4 then selfSay('Não está na hora do torneio...', cid) return true end end end end if doPlayerRemoveMoney(cid, torneiolukas.price) then doTeleportThing(cid, torneiolukas.waitPlace) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) o erro era só isso >> if getPlayerLevel(cid) >= 150 then < = + > = - Obrigado,aparentemente funcionou perfeitamente
Postado Agosto 19, 2017 7 anos Autor Em 18/08/2017 em 13:08, Alexy Brocanello disse: tome :D 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, 'torneio') then if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then selfSay('Você não pode entrar no torneio portando revives.', cid) return true end if getPlayerLevel(cid) >= 150 then selfSay('Desculpa, apenas players level 150- podem ir no torneio de Johto!', cid) return true end selfSay('Para entrar no torneio tem que pagar 20 hundred dollars, vai entrar?', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneiolukas.startHour1 or os.date("%X") > torneiolukas.endHour1 then if os.date("%X") < torneiolukas.startHour2 or os.date("%X") > torneiolukas.endHour2 then if os.date("%X") < torneiolukas.startHour3 or os.date("%X") > torneiolukas.endHour3 then if os.date("%X") < torneiolukas.startHour4 or os.date("%X") > torneiolukas.endHour4 then selfSay('Não está na hora do torneio...', cid) return true end end end end if doPlayerRemoveMoney(cid, torneiolukas.price) then doTeleportThing(cid, torneiolukas.waitPlace) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) o erro era só isso >> if getPlayerLevel(cid) >= 150 then < = + > = - alex,ainda continua com o msm problema,players consegue ir no 150- sendo level 150+,o script uma hora n puxa e outra hora puxa players 150+
Postado Agosto 20, 2017 7 anos Diretor 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 if msgcontains(msg, 'torneio') then if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then selfSay('Você não pode entrar no torneio portando revives.', cid) return true end selfSay('Para entrar no torneio tem que pagar 20 hundred dollars, vai entrar?', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneiolukas.startHour1 or os.date("%X") > torneiolukas.endHour1 then if os.date("%X") < torneiolukas.startHour2 or os.date("%X") > torneiolukas.endHour2 then if os.date("%X") < torneiolukas.startHour3 or os.date("%X") > torneiolukas.endHour3 then if os.date("%X") < torneiolukas.startHour4 or os.date("%X") > torneiolukas.endHour4 then selfSay('Não está na hora do torneio...', cid) return true end end end end if (getPlayerLevel(cid)) <= 150 then selfSay('Você não tem level suficiente.', cid) return true end if doPlayerRemoveMoney(cid, torneiolukas.price) then doTeleportThing(cid, torneiolukas.waitPlace) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) caso n der tente de baixo 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, 'torneio') then if (getPlayerLevel(cid)) <= 150 then if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then selfSay('Você não pode entrar no torneio portando revives.', cid) else selfSay('Você não tem level para entrar no torneio.', cid) return end end selfSay('Para entrar no torneio tem que pagar 20 hundred dollars, vai entrar?', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneiolukas.startHour1 or os.date("%X") > torneiolukas.endHour1 then if os.date("%X") < torneiolukas.startHour2 or os.date("%X") > torneiolukas.endHour2 then if os.date("%X") < torneiolukas.startHour3 or os.date("%X") > torneiolukas.endHour3 then if os.date("%X") < torneiolukas.startHour4 or os.date("%X") > torneiolukas.endHour4 then selfSay('Não está na hora do torneio...', cid) return true end end end end if doPlayerRemoveMoney(cid, torneiolukas.price) then doTeleportThing(cid, torneiolukas.waitPlace) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código. #OpenSource #Programação #Contribuição
Postado Agosto 20, 2017 7 anos Autor 3 horas atrás, Alexy Brocanello 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 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, 'torneio') then if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then selfSay('Você não pode entrar no torneio portando revives.', cid) return true end selfSay('Para entrar no torneio tem que pagar 20 hundred dollars, vai entrar?', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneiolukas.startHour1 or os.date("%X") > torneiolukas.endHour1 then if os.date("%X") < torneiolukas.startHour2 or os.date("%X") > torneiolukas.endHour2 then if os.date("%X") < torneiolukas.startHour3 or os.date("%X") > torneiolukas.endHour3 then if os.date("%X") < torneiolukas.startHour4 or os.date("%X") > torneiolukas.endHour4 then selfSay('Não está na hora do torneio...', cid) return true end end end end if (getPlayerLevel(cid)) <= 150 then selfSay('Você não tem level suficiente.', cid) return true end if doPlayerRemoveMoney(cid, torneiolukas.price) then doTeleportThing(cid, torneiolukas.waitPlace) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) caso n der tente de baixo 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, 'torneio') then if (getPlayerLevel(cid)) <= 150 then if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then selfSay('Você não pode entrar no torneio portando revives.', cid) else selfSay('Você não tem level para entrar no torneio.', cid) return end end selfSay('Para entrar no torneio tem que pagar 20 hundred dollars, vai entrar?', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneiolukas.startHour1 or os.date("%X") > torneiolukas.endHour1 then if os.date("%X") < torneiolukas.startHour2 or os.date("%X") > torneiolukas.endHour2 then if os.date("%X") < torneiolukas.startHour3 or os.date("%X") > torneiolukas.endHour3 then if os.date("%X") < torneiolukas.startHour4 or os.date("%X") > torneiolukas.endHour4 then selfSay('Não está na hora do torneio...', cid) return true end end end end if doPlayerRemoveMoney(cid, torneiolukas.price) then doTeleportThing(cid, torneiolukas.waitPlace) else selfSay('Você não tem dinheiro suficiente.', cid) end else selfSay('Até mais.', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) a segunda script parece que funcionou,mais eu tive que fazer uma pikena alteração if (getPlayerLevel(cid)) <= 150 then para if (getPlayerLevel(cid)) >= 150 then
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.