Postado Maio 16, 2016 9 anos Peguei no fórum o script de quizz de um npc. que conta no final quantas voce acertou e quantas errou. Queria colocar alguma recompensa se acertar todas. o script é esse focus = 0 talk_start = 0 target = 0 following = false attacking = false q = 1 w = 0 certas = 0 erradas = 0 question = {} question[1] = {p="Quem é o atual administrador do tibiaking sem ser o Gustavo?", r="don"} question[2] = {p="Quem é o coordenador registrado em julho de 2005?", r="caidera"} question[3] = {p="Como se chama o mascote do tibiaking?", r="x-boy"} question[4] = {p="Quem foi o primeiro colaborador de Actions do tibiaking", r="colex"} question[5] = {p="Quem foi o vencedor do 1º tibiaking Scripting Championship?", r="xxxhiagoxxx"} question[6] = {p="A regra número 3 da seção geral na parte OTServer fala sobre...", r="flood"} question[7] = {p="Qual o nome da rádio oficial do tibiaking?", r="jovemix"} question[8] = {p="Qual o nome da 1ª equipe a ter seu lugar no Incentivos tibiaking?", r="spol team"} question[9] = {p="Qual o username do antigo moderador atual apoio, cujo sua primeira letra é igual a primeira letra do nome do site?", r="x9kill"} question[10] = {p="Quem é o co-fundador da Spol Team?", r="bizugo"} question[11] = {p="Quem deu a idéia para o projecto X-OTS?", r="jvchequer"} question[12] = {p="Quem postou o code para NPCs venderem Bps de items?", r="frerety"} function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') selfLook(cid) focus = 0 talk_start = 0 end end function onCreatureTurn(creature) end function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) msg = string.lower(msg) if ((msgcontains(msg, 'hi')) and (focus == 0)) and getDistanceToCreature(cid) < 6 then selfSay('Olá, Eu sou um NPC de entertrenimento feito por Colex, para eu começar as perguntas digite: continuar.') focus = cid talk_start = os.clock() end if msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 6 then selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.') end if (focus == cid) and getDistanceToCreature(cid) < 6 then if (w == 1) then if msgcontains(msg, question[q].r) then selfSay('Certa resposta, diz Continuar para passar-mos a próxima pergunta!') talk_start = os.clock() q = q+1 certas = certas + 1 w = 0 else selfSay('Resposta errada, diz Continuar para passar-mos a próxima pergunta!') talk_start = os.clock() q = q+1 w = 0 erradas = erradas + 1 end else if msgcontains(msg, 'continuar') then if question[q] then selfSay(question[q].p) talk_start = os.clock() w = 1 else selfSay('Esta foi a última pergunta, voce teve ' .. certas .. ' respostas certas e ' .. erradas .. ' respostas erradas.') focus = 0 talk_start = 0 q = 1 w = 0 certas = 0 erradas = 0 end end end if msgcontains(msg, 'bye') or msgcontains(msg, 'xau') then selfSay('Adeus, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 q = 1 w = 0 certas = 0 erradas = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() if (os.clock() - talk_start) > 120 then if focus > 0 then selfSay('Próxima...') q = 1 w = 0 certas = 0 erradas = 0 end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Adeus então.') q = 1 w = 0 certas = 0 erradas = 0 end end end
Postado Maio 17, 2016 9 anos Esta é uma mensagem automática! Este tópico foi movido para a área correta.Pedimos que você leia as regras do fórum. Spoiler This is an automated message! This topic has been moved to the correct area.Please read the forum rules. ➥ Regras | Seções OTServ | Seções BOT
Postado Maio 17, 2016 9 anos local config = { item = 2160, -- ID do item. qnt = 5, -- quantidade do item. } focus = 0 talk_start = 0 target = 0 following = false attacking = false q = 1 w = 0 certas = 0 erradas = 0 question = {} question[1] = {p="Quem é o atual administrador do tibiaking sem ser o Gustavo?", r="don"} question[2] = {p="Quem é o coordenador registrado em julho de 2005?", r="caidera"} question[3] = {p="Como se chama o mascote do tibiaking?", r="x-boy"} question[4] = {p="Quem foi o primeiro colaborador de Actions do tibiaking", r="colex"} question[5] = {p="Quem foi o vencedor do 1º tibiaking Scripting Championship?", r="xxxhiagoxxx"} question[6] = {p="A regra número 3 da seção geral na parte OTServer fala sobre...", r="flood"} question[7] = {p="Qual o nome da rádio oficial do tibiaking?", r="jovemix"} question[8] = {p="Qual o nome da 1ª equipe a ter seu lugar no Incentivos tibiaking?", r="spol team"} question[9] = {p="Qual o username do antigo moderador atual apoio, cujo sua primeira letra é igual a primeira letra do nome do site?", r="x9kill"} question[10] = {p="Quem é o co-fundador da Spol Team?", r="bizugo"} question[11] = {p="Quem deu a idéia para o projecto X-OTS?", r="jvchequer"} question[12] = {p="Quem postou o code para NPCs venderem Bps de items?", r="frerety"} function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') selfLook(cid) focus = 0 talk_start = 0 end end function onCreatureTurn(creature) end function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) msg = string.lower(msg) if ((msgcontains(msg, 'hi')) and (focus == 0)) and getDistanceToCreature(cid) < 6 then selfSay('Olá, Eu sou um NPC de entertrenimento feito por Colex, para eu começar as perguntas digite: continuar.') focus = cid talk_start = os.clock() end if msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 6 then selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.') end if (focus == cid) and getDistanceToCreature(cid) < 6 then if (w == 1) then if msgcontains(msg, question[q].r) then selfSay('Certa resposta, diz Continuar para passar-mos a próxima pergunta!') talk_start = os.clock() q = q+1 certas = certas + 1 w = 0 else selfSay('Resposta errada, diz Continuar para passar-mos a próxima pergunta!') talk_start = os.clock() q = q+1 w = 0 erradas = erradas + 1 end else if msgcontains(msg, 'continuar') then if question[q] then selfSay(question[q].p) talk_start = os.clock() w = 1 else selfSay('Esta foi a última pergunta, voce teve ' .. certas .. ' respostas certas e ' .. erradas .. ' respostas erradas.') if certas == 12 then doPlayerAddItem (cid, config.item, config.qnt) end focus = 0 talk_start = 0 q = 1 w = 0 certas = 0 erradas = 0 end end end if msgcontains(msg, 'bye') or msgcontains(msg, 'xau') then selfSay('Adeus, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 q = 1 w = 0 certas = 0 erradas = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() if (os.clock() - talk_start) > 120 then if focus > 0 then selfSay('Próxima...') q = 1 w = 0 certas = 0 erradas = 0 end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Adeus então.') q = 1 w = 0 certas = 0 erradas = 0 end end end Não dou suporte via PM, crie um tópico caso tenha dúvidas. Isso previne que outras pessoas com a mesma dúvida criem tópicos desnecessários.
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.