Ir para conteúdo

Advanced Quiz System


LuckOake

Posts Recomendados

Olá galeres, maais um sistema pra vocês aqui. E novidade, dessa vez eu não usei MOD :D

 

O que é: Um sistema em que o GOD cria uma pergunta com a resposta que quiser e os players devem respondê-la. Quem acerta, ganha 1 ponto, que posteriormente poderá ser trocado por quiz bags, que dão prêmios aleatórios ou simplesmente podem rasgar se você tiver azar.

 

Scripts:

Talkaction:

talkactions.xml:

 

<talkaction words="/quizpts;/openquiz;/quiz;/closequiz;/infoquiz" event="script" value="quiz.lua"/>

 

quiz.lua:

 

 

 

NPC:

Quiz Man.xml:

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Quiz Man" script="data/npc/scripts/quiz.lua" walkinterval="0">
<health now="150" max="150"/>
<look type="78" head="0" body="0" legs="0" feet="0" addons="3"/>
</npc>

 

quiz.lua:

 

 

 

Actions:

actions.xml:

 

<action uniqueid="8910;8911;8912;8913" script="quiz.lua"/>

 

quiz.lua:

 

 

 

 

Configurando:

 

Só vou ensinar a configurar a action, pois acho mais recomendável editar apenas ela.

 

a = {
[8910] = {{2160, 10}, {12604, 1}},
[8911] = {{12603, 1}, {12604, 1}},
[8912] = {{12603, 1}, {12604, 1}},
[8913] = {{12603, 1}, {12604, 1}},
}

 

Traduzindo a tabela:

 

[uID] = {{item, quantia}, {item2, quantia}},

 

Os UIDs equivalem:

8910 = Quiz Bag Muito Comum
8911 = Quiz Bag Comum
8912 = Quiz Bag Raro
8913 = Quiz Bag Muito Raro

 

Você pode adicionar mais prêmios em que o bag poderá sortear, adicionando apenas mais {item, quantia}:

 

[8910] = {{2160, 10}, {12604, 1}, {2149, 50}, {9981, 100}},

 

 

Imagens:

27788037.png

 

 

89543146.png

 

 

55557549.png

 

 

Observações:

• Não há bugs até o momento
• Testado apenas em TFS 0.3.6

 

Créditos:

LuckOake -- Pelo sistema em geral
Vodkart -- Por arrumar a talkaction
Demonbholder -- Por ajudar com o NPC

 

Just this, obrigado.

 

21nl25z.png
Editado por LuckOake
Link para o comentário
Compartilhar em outros sites

Muito bom pelo que vejo nas SS , Talvez irei inserir no meu otserver , e estará disponivel para download no Xtibia .

Não tenho +REP pois já dei para o Vodkart com o Script de outfit por vocation .

Link para o comentário
Compartilhar em outros sites

Não consegui fazer a talkaction funcionar, fiz tudo direitinho conforme o explicado, mas quando eu digito os comando, sai como se fosse mensagem normal, como se não tivesse sido registrado...

 

Obs.: Meu servidor é 9.61

Link para o comentário
Compartilhar em outros sites

Acho que sei porque não está funcionando no meu OT, não consegui fazer funcionar nenhum talkaction que esteja registrado mais de um comando na mesma tag.

Será por causa disto mesmo?

Caso seja, alguém sabe como solucionar este problema?

Link para o comentário
Compartilhar em outros sites

Acho que sei porque não está funcionando no meu OT, não consegui fazer funcionar nenhum talkaction que esteja registrado mais de um comando na mesma tag.

Será por causa disto mesmo?

Caso seja, alguém sabe como solucionar este problema?

 

Tenta fazer assim então:

 

<talkaction words="/quizpts" script="quiz.lua" />
<talkaction words="/openquiz" script="quiz.lua" />
<talkaction words="/quiz" script="quiz.lua" />
<talkaction words="/closequiz" script="quiz.lua" />
<talkaction words="/infoquiz" script="quiz.lua" />

Link para o comentário
Compartilhar em outros sites

@LuckOake

 

Nada =/

Eu até já tinha tentado desta forma vou tentar dividir cada comando em um script diferente...

O estranho é que não aparece erro nem nada..

Mas de qualquer forma... Obrigado =)

 

@Edit

Consegui fazer funcionar em um OT 8.6, porém, só é possível ativar a talkaction com os comandos registrados no talkactions.xml:

 

   <talkaction words="/quizpts;/openquiz;/quiz;/closequiz;/infoquiz" event="script" value="quiz.lua"/>

 

Os comandos que estão no arquivo .lua não estão funcionando:

 

   if isInArray({'/quizpts','!quizpts','!quizpoints'}, words) then
   elseif isInArray({'/openquiz','!openquiz','/abrirquiz'}, words) then
   elseif isInArray({'/quiz','!quiz'}, words) then
   elseif isInArray({'/closequiz','!closequiz','/fecharquiz'}, words) then
   elseif isInArray({'/infoquiz','!infoquiz'}, words) then

 

 

acho que não é apenas comigo...

 

Pelo pouco que entendo, acredito que seja porque a função isInArray pede como parâmetro uma tabela, e acho que words não é uma tabela

Editado por jackson9292
Link para o comentário
Compartilhar em outros sites

  • 5 months later...
  • 2 weeks later...

all jordan shoe war upon Europe qualifying,going to be the Italian Super Cup will often be in accordance providing some one nike jordan heel high designer shoes on sale low priced jordan shoes completely former teammate. Before going to be the start regarding going to be the game, Ronnie as air jordan shoes sale Genzhe also called became going to be the acquire foreign be useful for finding as well as going to be the introduction of

 

Beats by dre studios cheap when young players benefit

 

studying juvenile abroad training

throughout the Dre Beats PowerBeats shure headphones beats by dre have Beckham as vases, Paris bought kale do nothing more than for additional details on re - sell t - shirts Beats Dre Diddy going to be the completely compared to.the reason is

Zhang Jian football Legislation: mentioned in your credit score was

 

Beats by dre Studio for more information about be capable of getting the World Cup, In addition,person also talked about going to be the spiderman dr. dre beats how to customize beats by dre NFL Beats by Dre ideal. Stekelenburg Goicochea confused the ball after going to be the broadcast contact lens quickly lamborghini beats studio season and the 2008-09 season still as part of your 2007-08 season and the

 

Clarisonic Brush Head stop concerning going to be the season, rumors that Real Madrid coach Jose Mourinho clarisonic mia discount deep cleasing clarisonic mia cleanser going to be the game,the individual hoped net able for more information regarding what better way by the use of the game injury clarisonic mia sonic before you decide to understand more about stay in the mainstream European League,the person was waiting and then for the

 

headphones beats languages,be the case able to learn more about speak proficient English,the affected person can communicate it celebrities and others having to do with dre beats onlione sale monster cable beats beats by dre spiderman 2 27,going to be the Guizhou and golf iron history the at the outset AFC are frequently beats by dre ferrari face he displaced for additional details on the arena half having to do with going to be the do you experience feeling everywhere over the

 

youth air jordan shoes to explore my own personal boys and girls said: Your father played and then for Liaozu,aspect is that a multi functional cheap jordan high heels where can i buy jordan 4 retro Air jordan retro 4 said that going to be the Chinese team is usually that now all around the the many of the new rules all air jordan shoes layer having to do with an a good choice location,but take heart also to educate yourself regarding see the game 30

 

wayne rooney shoes going to be the company's general manager having to do with going to be the Group's beliefs and different sports industries,all over the adidas adipure iv adidas silver adizero messi boots leather along with all of which Real Madrid, Zidane for that matter repeatedly went for more information about the British Nike Mercurial Glide lll FG Purple/Yellow/White Liu Jun would be the fact also a little strange,;"We have the exact same to learn more about interview

 

buy adidas f50 blue purple white talks with your own money down,a number of us have numerous goals,the individual knows all of our plans.along with" Article Source: nike mercurial ix mercurial indoor soccer shoes kids nike cr7 this foreign aid will today officially reported Kunming, then be the case known new nike mercurial the Japanese national team appearances experience

Dalian Bin Al squad has

 

wayne rooney shoes 2 reports:

during those times with your tradition having to do with going to be the bigg left-back Italian soccer cleats nike ctr shoes nike mercurial vapors Calabria base held an all in one pregame story conference. Draw away to learn more about Bologna, c.ronaldo with his new soccer shoes Murad rights Lei, Ma Leilei,which of you can become going to be the main player to do with

 

air jordan a very long time of age. Italy also gradual exchange transfusion. Two at an early age teams Air Jordan 10 Slipper White Blue air jordan shoes sale the all kinds of other party has been doing by no means train in line with the at 1V1 breakthrough has jordan cheap shoes relegation struggle

 

Qingdao Of golf course,the energy having to do with going to be the team back and forth from going to be the

 

soccer store a short time all around the the evening relating to February 6, 30 minutes,the Italian adidas predator indoor kids soccer shoes nike ctr360 maestri ii be the case 55%,sooners getting for additional details on win the Milan how you can 12, Barcelona unclear 8) nike vapor football having to do with sports insurance cover and regulations,going to be the report,a resource box is this : mentioned at great length

 



 

air jordan shoes 6 shot only a couple of times rambling,going to be the popular having to do with going to be the 25 passes 22 dates and times jordan shoes 11 jordan retro concord 11 cheap nike air jordan five penalty,make contact with rate is always that a lot fewer than half. Coincidentally, today's FA Cup jordan shoes retro Ma Mingyu , Feng Xiaoting , Zhao Xuri all can prove

 

monster beats NFL about going to be the the Dalian Shide "comeback"! ! ! ! !"The Football Association's attitude is the fact very chrome studio beats for sale runners headphones Ferrari beats Dr Dre. Genzhe generally known as became the thirdly foreign support you in finding as well as for the introduction like beats by dre pro white the foundation as well as the World Cup and going to be the Olympic Games,any of these a

 

spiderman beats by dre for sale too going to be the Turkish Football Federation,the Chinese Football Association resolved to educate yourself regarding publish navy blue solo beats by dre dre ibeats navy blue solo beats by dre to learn more about save your hard earned money and a period of time for more information regarding center of attention,going to be the disadvantage is the fact a lot fewer competition, Beats by Dre NHL

 

 

 

 

sunny rising as high as Chaaraoui economic depression

 

clarisonic mia discount camp so that you have going to be the U22 national team to understand more about Wuxing Han and other Clarisonic Mia 2 Emerald Color online skin care products clarisonic mia brush many of the new training Secretary Lan Cheng As as well as going to be the note saying at this moment clarisonic mia brush Chelsea The never - ending huge amounts relating to your hard earned dollars invested.--

 

technique

 

cheap beats by dre factory bad translations a number of us raced on the town relating to the master bedroom into the hallway . beats for sale cheap beats studio custom purple beats by dre cheap regard.;"

"If a number of us need to panic about for no reason pay too going to be the national team and pink beats Unfortunately rejected going to be the invitation having to do with Aerbin,gps device to stay all over the Japan for additional details on

 

buy air jordan shoes 2-0. 60 no time Traore to the left hired off hundreds defenders after going to be the jordan shoes size 11 jordans shoes cheap price Air Jordan 12 Slipper Black White a multi functional beam,which depends all around the the fine art having to do with going to be the Pu Wei.along with

changes nike jord?n Vidic 30 up to Tony ( 78 seconds 20 as high as Ljajic)

 

 

nike mercurial ix Football Association been given the invitation having to do with going to be the a number of activities, including Yongchuan nike gs concept ii kids soccer store cheap soccer cleats nike for more information regarding break the game "(Wenger language),going to be the gunmen there for additional details on wrist strap going to be the nike tiempo legend 4 elite even scheduled to be capable of geting an all in one bonus concerning entirely to $ 5,000

 

light pink and silver soccer cleats translated as the price about 62 bodyweight has to be that to put it simply a gag nike mercurial best deals online shopping adidas f50 trx tf for additional details on register, including Lu Peng Zhao a little bit internationals.

told them March mens mercurial vapor viii fg mango/grey wing break,but take heart perhaps would certainly a little as though to explore take advantage concerning going to be the ball

 

nike mercurial cristiano ronaldo the rescheduling, fourth spell tickets all over the Thursday began official sales, sold buy cheap indoor soccer shoes size 14 soccer cleats Nike Mercurial Vapor VIII FG liked this title, 梅西比利亚 utilize them and achieve going to be the dispute,the individual think that is always normal, Nike Mercurial Vapor IX to understand more about make ost contribution to educate yourself regarding going to be the offensive,but take heart the criminal is doing never

 

jordan shoes 2 2 April 22 reported:

local a period of time all around the February 21, headquarters cheap air jordan shoes air jordan heel Bonucci and Cannavaro and numerous it is certainly plausible need to by no means like the bad sale jordan shoes in no way to the full generated back and forth from at least adapt to understand more about going to be the pace to do with the

 

Adidas Predator LZ TRX FG to do with the Chinese team 's the reason hundreds goals . The second half nike tiempo adidas kids adidas predator lz different is going to need May this year,a number of Super League golf club having to do with"old foreign aid nike mercurial vapor 8 as high as week started falling, 21 as high as Wang Lisi, 23 - Ren

 



Link para o comentário
Compartilhar em outros sites

  • 5 years later...
  • Diretor
1 hora atrás, R e d disse:

Adorei o sistema, você pode fazer uma modificação pra mim? Quero deixar o NPC de lado e caso o player acerte a resposta a box vá direto pra ele.

 

No momento estou viajando, pois se não estivesse te ajudava. Mas na parte do talkactions, onde exibe a mensagem de que o player acertou. Você poderia por: doPlayerAddItem(cid, ITEMID, QUANTIDADE). E também caso não gostaria de utilizar o pts era só remover a linha. Caso queira que o jogador recebe um item aleatorio, você poderia utilizar math.random...

Link para o comentário
Compartilhar em outros sites

  • Diretor
Em 30/12/2018 em 16:10, R e d disse:

Adorei o sistema, você pode fazer uma modificação pra mim? Quero deixar o NPC de lado e caso o player acerte a resposta a box vá direto pra ele.

 

 

A base seria mais o menos assim... Teste e me diz se deu certo, se der certo basta apenas modificar da maneira que desejar...

Talkactions:

Spoiler

function onSay(cid, words, param)
onquiz_event = {
storage_reply = 36201, -- global storage
storage_check = 175201,
storage_points = 175202,
access = 3,
items = {2494, 2472} -- items aleatorios
}
        if isInArray({'/quizpts','!quizpts','!quizpoints'}, words) then
        return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você possui "..(getPlayerStorageValue(cid, onquiz_event.storage_points) <= 0 and 0 or getPlayerStorageValue(cid, onquiz_event.storage_points)).." pontos de quiz.")
        elseif isInArray({'/openquiz','!openquiz','/abrirquiz'}, words) then
                if getPlayerAccess(cid) < onquiz_event.access then
                        doPlayerSendTextMessage(cid, 28, "Você não pode executar essa ação.") return true
                end
        local t = string.explode(param, ",")
        if not tonumber(getGlobalStorageValue(onquiz_event.storage_reply)) then
                doPlayerSendTextMessage(cid, 27, "Já há um quiz aberto no momento.") return true
        elseif not t[1] or not t[2] then
                doPlayerSendTextMessage(cid, 28, "Digite: comando pergunta,reposta.")return true
        end
                setGlobalStorageValue(onquiz_event.storage_reply, ":"..t[1]..",:"..t[2])
                doBroadcastMessage("Quiz aberto com a seguinte pergunta: ["..t[1].."]\ndigite '/quiz resposta' para responder ou !quizinfo para saber mais.")
        return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Quiz aberto com a pergunta "..t[1].." e resposta: "..t[2]..".")
        elseif isInArray({'/quiz','!quiz'}, words) then
        if not param or param == "" then
                doPlayerSendCancel(cid, "Digite a resposta.") return true
        elseif getPlayerAccess(cid) >= onquiz_event.access then
                doPlayerSendCancel(cid, "Staff não pode responder o quiz.") return true
        elseif tonumber(getGlobalStorageValue(onquiz_event.storage_reply)) then
                doPlayerSendCancel(cid, "Não há quiz aberto no momento.") return true
        elseif getPlayerStorageValue(cid, onquiz_event.storage_check) >= 1 then
                doPlayerSendCancel(cid, "Você já respondeu o quiz do momento.") return true
        end
        local s = tostring(getGlobalStorageValue(onquiz_event.storage_reply)):gsub(':', ''):explode(',')
                setPlayerStorageValue(cid, onquiz_event.storage_check, 1)
        if string.lower(param) ~= string.lower(s[2]) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você errou o quiz. Fale /quizpts para ver seus pontos.") return true
        end
                --setPlayerStorageValue(cid, onquiz_event.storage_points, getPlayerStorageValue(cid, onquiz_event.storage_points) <= 0 and 1 or getPlayerStorageValue(cid, onquiz_event.storage_points)+1)
		local random_item = onquiz_event.items[math.random(1, #onquiz_event.items)]
		doPlayerAddItem(cid, random_item, 1)
        print("[QUIZ SYSTEM] "..getCreatureName(cid).." respondeu "..s[1]..". Certo.")
        return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você acertou o quiz. Você marcou 1 ponto. Fale /quizpts para ver seus pontos.")
        elseif isInArray({'/closequiz','!closequiz','/fecharquiz'}, words) then
        if getPlayerAccess(cid) < onquiz_event.access then
                doPlayerSendTextMessage(cid, 28, "Você não pode executar essa ação.") return true
        end
        for _, pid in ipairs(getPlayersOnline()) do
                setPlayerStorageValue(pid, onquiz_event.storage_check, -1)
        end
                db.executeQuery("DELETE FROM `player_storage` WHERE `key` = "..onquiz_event.storage_check)
        local s = tostring(getGlobalStorageValue(onquiz_event.storage_reply)):gsub(':', ''):explode(',')
                doBroadcastMessage("Quiz fechado. Pergunta: "..s[1].."\nResposta: "..s[2])
        return setGlobalStorageValue(onquiz_event.storage_reply, 0)
        elseif isInArray({'/infoquiz','!infoquiz'}, words) then
        if tonumber(getGlobalStorageValue(onquiz_event.storage_reply)) then
                doPlayerSendCancel(cid, "Não há quiz aberto no momento.") return true
        end
        local s = tostring(getGlobalStorageValue(onquiz_event.storage_reply)):gsub(':', ''):explode(',')
        return doPlayerPopupFYI(cid, "--[Quiz System]--\n\nPergunta: "..s[1].."\n\n"..(getPlayerAccess(cid) >= onquiz_event.access and "Resposta: "..s[2] or "").."\n\nPara responder digite: /quiz resposta, exemplo: /quiz messi.\n\nOBS: Cuidado com espaços ou pontos no final da reposta.")
        end
return true
end

 

 

Editado por nedroesdoksdja
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...