Advertisement
Tectoon

[TFM] Quiz em Construção

Apr 27th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.80 KB | None | 0 0
  1. souris = {}
  2. for n,p in pairs(tfm.get.room.playerList) do
  3.     table.insert(souris,n)
  4. end
  5. question = ""
  6. reponse = ""
  7. enqueteur = souris[math.random(1,#souris)]
  8. validerOnA = false
  9. validerOnB = false
  10.  
  11. tfm.exec.disableAutoShaman(true)
  12. tfm.exec.disableAutoNewGame(true)
  13. tfm.exec.disableAfkDeath(true)
  14. tfm.exec.newGame("@4474417")
  15. tfm.exec.setUIMapName("Cada um o seu quizzes <T> ! Mapa | @4474417")
  16.  
  17. function eventNewGame()
  18.     youAreEnqueteur()
  19. end
  20.  
  21. function youAreEnqueteur()
  22.  
  23.     tfm.exec.setUIMapName("Cada um o seu quizzes ! <font color='#6C77C1'>|</font> @4474417 <font color='#6C77C1'>|</font> O investigador é <font color='#009D9D'>"..enqueteur.."</font>                                                    ")
  24.     tfm.exec.movePlayer(enqueteur, 410, 255)
  25.     ui.addTextArea(1, "<p align='center'>Cabe a você escolher a pergunta e a resposta!</p>", enqueteur, 10, 30, 770,50)
  26.     ui.addTextArea(2, "<a href='event:reponse'><font color='#FF0000'>Editar resposta</font></a>", enqueteur, 430, 55)
  27.     ui.addTextArea(3, "<a href='event:question'><font color='#FF0000'>Editar Pergunta</font></a>", enqueteur, 250, 55)
  28.     ui.addTextArea(4, "<font color='#FF0000'>Iniciar</font>", enqueteur, 375, 55)
  29.    
  30.  
  31. end
  32.  
  33. function eventTextAreaCallback(id,name,callback)
  34.   if callback=="question" then
  35.     ui.addPopup(5,2,"Digite sua pergunta aqui",enqueteur,307,100,200)
  36.   end
  37.   if callback=="reponse" then
  38.     ui.addPopup(6,2,"Digite a resposta. <font color='#009D9D'> Não coloque ! antes da palavra !.</font>",enqueteur,307,100,200)
  39.   end
  40.   if callback=="valider" then
  41.     ui.addTextArea(1, "<p align='center'><font color='#BABD2F'>"..enqueteur.." escolheu a pergunta! Para que você possa encontrar a resposta ! A questão :</font><br><font color='#009D9D'>"..question.."</font><br><font color='#BABD2F'>Se você encontrar a resposta, você vai tomar o lugar de "..enqueteur.." !</p></font>", all, 10, 30, 770,50)
  42.     reponsedef = reponse
  43.     ui.addTextArea(5, 'Réponse: '..reponsedef..'', enqueteur, 306, 143, 200, 20)
  44.   end
  45. end
  46.  
  47. function eventPopupAnswer(idpopup, playerName, answer)
  48.   if idpopup==5 then -- question
  49.     question = answer
  50.     tfm.exec.displayParticle(5, 340, 220,0,0,0,0,nil)
  51.     ui.addTextArea(3, "<a href='event:question'><font color='#18CD30'>Editar Questão</font></a>", enqueteur, 250, 55)
  52.     validerOnA = true
  53.  
  54.     if validerOnA then
  55.       if validerOnB then
  56.         ui.addTextArea(4, "<a href='event:valider'><font color='#18CD30'>Validar</font></a>", enqueteur, 375, 55)
  57.       end
  58.     end
  59.  
  60.   end
  61.   if idpopup==6 then -- reponse
  62.     reponse = string.lower(answer)
  63.     tfm.exec.displayParticle(12, 490, 220,0,0,0,0,nil)
  64.     ui.addTextArea(2, "<a href='event:reponse'><font color='#18CD30'>Editar resposta</font></a>", enqueteur, 431, 55)
  65.     validerOnB = true
  66.     if validerOnA then
  67.       if validerOnB then
  68.         ui.addTextArea(4, "<a href='event:valider'><font color='#18CD30'>Validar</font></a>", enqueteur, 375, 55)
  69.       end
  70.     end
  71.  
  72.   end
  73. end
  74.  
  75. function eventChatCommand(playerName, message)
  76.   if message ==tostring(reponsedef) then
  77.     tfm.exec.killPlayer(enqueteur)
  78.     tfm.exec.respawnPlayer(enqueteur)
  79.     reponsedef = 1
  80.     enqueteur = playerName
  81.     validerOnA = false
  82.     validerOnB = false
  83.     ui.addTextArea(1, "<p align='center'><font color='#BABD2F'>"..enqueteur.." encontrei a resposta! <br>É para ele escolher a questão !</font></p><font color='#009D9D'>Para responder a uma pergunta , !Resposta.</font>", all, 10, 30, 770,50)
  84.     youAreEnqueteur()
  85.   end
  86. end
  87.  
  88. function eventPlayerDied(playerName)
  89.     tfm.exec.respawnPlayer(playerName)
  90. end
  91.  
  92. function eventNewPlayer(playerName)
  93.     tfm.exec.respawnPlayer(playerName)
  94. end
  95.  
  96.  
  97. for name in pairs(tfm.get.room.playerList) do
  98. tfm.exec.bindKeyboard(name,77,true,true)
  99. end
  100. function eventKeyboard(name,key,down,x,y)
  101. if key==77 then
  102. tfm.exec.addShamanObject(34 ,x,y +18)
  103. end
  104. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement