Postado Agosto 11, 2018 6 anos bom Galera e o seguinte estou tendo um problema de players entrando com revive no torneio , mesmo o npc proibindo a entrada , basta o player fala yes que o npc por algum motivo deixa ele entrar alguem sabe como resolver? rep + SCRIPT DO NPC Spoiler 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') or msgcontains(msg, 'enter') then if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then selfSay('You can not enter the tournament with {revives}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12343) >= 1 then selfSay('You can not enter the tournament with {revives}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12345) >= 1 then selfSay('You can not enter the tournament with {revives}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12344) >= 1 then selfSay('You can not enter the tournament with {revives}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12346) >= 1 then selfSay('You can not enter the tournament with {revives}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12347) >= 1 then selfSay('You can not enter the tournament with {revives}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12348) >= 1 then selfSay('You can not enter the tournament with {revives}, please throw them out.', cid) return true end selfSay('You want to participate in the tournament by '..torneio.price..' gps / dollars?', cid) talkState[talkUser] = 2 elseif talkState[talkUser] == 2 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneio.startHour or os.date("%X") > torneio.endHour then selfSay('Registration for the tournament finished, come back later.', cid) return true end if doPlayerRemoveMoney(cid, torneio.price) then doTeleportThing(cid, torneio.waitPlace) doPlayerSendTextMessage(cid, 21, "Welcome, this is the waiting room, you wait here while the tournament does not start. Start time: {"..torneio.endHour.."}.") else selfSay('You do not have enough money ('..torneio.price..').', cid) end else selfSay('Sure you do not want to participate? Okay, see you next time!', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Agosto 13, 2018 6 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,msg = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid,msg:lower() local item_block = {12343,12345,12344,12346,12347,12348} -- coloque o id dos revives e itens que queira bloquear if msgcontains(msg, 'torneio') or msgcontains(msg, 'enter') then for _, var in pairs(item_block) do if getPlayerItemCount(cid, var) > 0 then selfSay('You can not enter the tournament with revives, please throw them out.', cid) return true end end selfSay('You want to participate in the tournament by '..torneio.price..' gps / dollars?', cid) talkState[talkUser] = 2 elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then if os.date("%X") < torneio.startHour or os.date("%X") > torneio.endHour then selfSay('Registration for the tournament finished, come back later.', cid) return true elseif not doPlayerRemoveMoney(cid, torneio.price) then selfSay('You do not have enough money ('..torneio.price..').', cid) return true end doTeleportThing(cid, torneio.waitPlace) doPlayerSendTextMessage(cid, 21, "Welcome, this is the waiting room, you wait here while the tournament does not start. Start time: {"..torneio.endHour.."}.") return true elseif msg == 'no' then selfSay('Sure you do not want to participate? Okay, see you next time!', cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) coloque o id de todos os itens que queira bloquear nesta tabela, acho que faltou alguns, confere ai!! local item_block = {12343,12345,12344,12346,12347,12348} -- coloque o id dos revives e itens que queira bloquear [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Agosto 16, 2018 6 anos Em 12/08/2018 em 21:31, Vodkart 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,msg = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid,msg:lower() local item_block = {12343,12345,12344,12346,12347,12348} -- coloque o id dos revives e itens que queira bloquear if msgcontains(msg, 'torneio') or msgcontains(msg, 'enter') then for _, var in pairs(item_block) do if getPlayerItemCount(cid, var) > 0 then selfSay('You can not enter the tournament with revives, please throw them out.', cid) return true end end selfSay('You want to participate in the tournament by '..torneio.price..' gps / dollars?', cid) talkState[talkUser] = 2 elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then if os.date("%X") < torneio.startHour or os.date("%X") > torneio.endHour then selfSay('Registration for the tournament finished, come back later.', cid) return true elseif not doPlayerRemoveMoney(cid, torneio.price) then selfSay('You do not have enough money ('..torneio.price..').', cid) return true end doTeleportThing(cid, torneio.waitPlace) doPlayerSendTextMessage(cid, 21, "Welcome, this is the waiting room, you wait here while the tournament does not start. Start time: {"..torneio.endHour.."}.") return true elseif msg == 'no' then selfSay('Sure you do not want to participate? Okay, see you next time!', cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) coloque o id de todos os itens que queira bloquear nesta tabela, acho que faltou alguns, confere ai!! local item_block = {12343,12345,12344,12346,12347,12348} -- coloque o id dos revives e itens que queira bloquear pode edita nesse aqui ? pra mim , o meu ta desse jeito mais ele ta igual o do yuri , player fala yes e entra com revive e potion .. ESSES AI SAO OS ID QUE QUERO BLOQUEA aqui o script do torneio 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') or msgcontains(msg, 'enter') then if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then selfSay('You can not enter the tournament with {revives or potions}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12343) >= 1 then selfSay('You can not enter the tournament with {revives or potions}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12344) >= 1 then selfSay('You can not enter the tournament with {revives or potions}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12345) >= 1 then selfSay('You can not enter the tournament with {revives or potions}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12346) >= 1 then selfSay('You can not enter the tournament with {revives or potions}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12347) >= 1 then selfSay('You can not enter the tournament with {revives or potions}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12348) >= 1 then selfSay('You can not enter the tournament with {revives or potions}, please throw them out.', cid) return true elseif getPlayerItemCount(cid, 12349) >= 1 then selfSay('You can not enter the tournament with {revives or potions}, please throw them out.', cid) return true end selfSay('Voce quer Participar no torneio por '..torneio.price..' de Dollars?', cid) talkState[talkUser] = 2 elseif talkState[talkUser] == 2 then if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if os.date("%X") < torneio.startHour1 or os.date("%X") > torneio.endHour1 then if os.date("%X") < torneio.startHour2 or os.date("%X") > torneio.endHour2 then if os.date("%X") < torneio.startHour3 or os.date("%X") > torneio.endHour3 then if os.date("%X") < torneio.startHour4 or os.date("%X") > torneio.endHour4 then if os.date("%X") < torneio.startHour5 or os.date("%X") > torneio.endHour5 then if os.date("%X") < torneio.startHour6 or os.date("%X") > torneio.endHour6 then if os.date("%X") < torneio.startHour7 or os.date("%X") > torneio.endHour7 then if os.date("%X") < torneio.startHour8 or os.date("%X") > torneio.endHour8 then selfSay('As inscrições para o torneiro ainda não abriram, volte ás 07:50 AM, 09:50 AM, 11:50 AM, 13:50 AM, 17:50 AM, 19:50 AM ou ás 21:50 PM todo os dias', cid) return true end end end end end end end end if doPlayerRemoveMoney(cid, torneio.price) then doTeleportThing(cid, torneio.waitPlace) doPlayerSendTextMessage(cid, 21, "Bem vindo, esta e a sala de espera, voce espera aqui enquanto o torneio nao começa.") else selfSay('Voce não tem ('..torneio.price..') Dollars.', cid) 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())
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.