Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 03/04/2016
- --Last update: 26/05/2016
- --[[ Notes:
- Does:
- Vence aquele que responder todas as perguntas corretamente mais rápido
- Adding questions:
- Na tabela P:
- [Número da questão] = {"Pergunta","Resposta"},
- { [Número da alternativa] = {"Letra da alternativa","Texto da Alternativa"},
- [Número da alternativa] = {"Letra da alternativa","Texto da Alternativa"},
- };
- ]]--
- P = {
- [1] = {
- {"Por que o Bolodefchoco cobra caro?","C"},
- { [1] = {"A","Por motivos pessoais"},
- [2] = {"B","Por que quer"},
- [3] = {"C","Por que você depende dele"},
- }
- };
- [2] = {
- {"Satã é viado?","A"},
- { [1] = {"A","Nunca"},
- [2] = {"B","Sim"},
- }
- };
- }
- mice={}
- eventNewPlayer=function(n)
- mice[n]={points = 0}
- tfm.exec.setPlayerScore(n,mice[n].points)
- end
- table.foreach(tfm.get.room.playerList,eventNewPlayer)
- done = false
- displayQuestion=function(n)
- for id = #P,1,-1 do
- local answ = ""
- for i,v in next,P[id][2] do
- answ = answ .. tostring(P[id][2][i][1])..") <a href='event:"..tostring(P[id][2][i][1]).."'>"..P[id][2][i][2].."</a>\n"
- end
- ui.addTextArea(id,P[id][1][1]..'\n\n'..answ,n,200,50,400,300)
- end
- end
- table.foreach(tfm.get.room.playerList,function(n) displayQuestion(n) end)
- eventTextAreaCallback=function(i,n,c)
- if not done then
- if P[i][1][2] == c then
- mice[n].points = mice[n].points + 1
- tfm.exec.setPlayerScore(n,mice[n].points)
- end
- ui.removeTextArea(i,n)
- if i == #P then
- if mice[n].points < #P then
- mice[n].points = 0
- tfm.exec.setPlayerScore(n,mice[n].points)
- displayQuestion(n)
- else
- ui.addTextArea(100*100,"\n\n\n<font size='50'><R>"..n.." <V>venceu!",nil,5,25,795,400)
- done = false
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement