Advertisement
UniverseTeam

Transformice: Sala de Sorteios (v1.0)

Jun 28th, 2016
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.60 KB | None | 0 0
  1.  
  2. -- Em SeuNome coloque o seu nickname
  3. -- Em Sorteio de Teste coloque o nome do sorteio
  4.  
  5. adm = "SeuNome"
  6. nome = "Sorteio de Teste"
  7.  
  8. mapa=[[<C><P Ca="" /><Z><S><S L="800" H="50" X="401" N="" Y="386" T="0" P="0,0,0.3,0.2,0,0,0,0" /></S><D><P C="ac2d0c" Y="373" T="15" P="0,0" X="563" /><P C="ac2d0c" Y="373" T="15" X="707" P="0,0" /><P C="ac2d0c" Y="373" T="15" X="90" P="0,0" /><P C="ac2d0c" Y="373" T="15" P="0,0" X="233" /><P C="bd4adb" Y="361" T="130" X="463" P="0,0" /><P C="bd4adb" Y="361" T="130" P="0,0" X="337" /><DS Y="200" X="400" /></D><O /></Z></C>]]
  9.  
  10. participante = {}
  11. inicio = false
  12. fim=false
  13. qtd=0
  14. fast=0
  15.  
  16. tfm.exec.disableAfkDeath(true)
  17. tfm.exec.disableAutoShaman(true)
  18. tfm.exec.disableAutoNewGame(true)
  19.  
  20. function eventTextAreaCallback(id, p, cmd)
  21.     tfm.exec.respawnPlayer(playerName)
  22.     tfm.exec.setNameColor(adm, 0xd60004)
  23.     if cmd == "entrada" then
  24.         ui.addTextArea(0, "<p align='center'>Participando", p, 200, 370, 400, 20, 1, 0x00ff00, 0.8,false)
  25.         entrada(p, #participante + 1)
  26.         elseif cmd == "credits" then
  27.         ui.addPopup(-2, 0, "<font color='#EDD200' size='15'><p align='center'><s>Creditos</p></font> <p align='left'><s>Programado por: Ricat1998</p> <p align='left'><s>Desenvolvido por: Universe Team</p> <p align='left'><s>Versão em execução: 1.0.0</p> <p align='left'><s> </p> <p align='left'><s>Universe Team & Transformice Universe</p> <p align='left'><s>© 06/2016 Versão Portuguesa (BR)</p>", p, 40, 120, 250, false)
  28.         elseif cmd == "ajuda" then  
  29.         ui.addPopup(-5, 0, "<font color='#EDD200' size='15'><p align='center'><s>Ajuda & FAQ</p></font> <p align='left'><s>1) Eu posso sair do cafofo?</p> <p align='left'><s>- Sim, você pode sair do cafofo que continuará registado no sorteio.</p> <p align='left'><s>2) Como participo no sorteio?</p> <p align='left'><s>- Para participar no sorteio clique em participar na barra cá em baixo.</p> <p align='left'><s>3) Quando vai começar o sorteio?</p> <p align='left'><s>- O sorteio começa quando o admistrador assim o entender.</p>", p, 300, 120, 460, false)
  30.     elseif cmd == "inicio" then
  31.         ui.addPopup(0, 2, "<p align='center'>Quantidade de vencedores", p, 300, 200, 200, false)
  32.     elseif cmd == "novo" then
  33.         novo()
  34.     end
  35. end
  36.  
  37. function eventNewPlayer(p)
  38.     tfm.exec.respawnPlayer(p)
  39.     tfm.exec.setNameColor(adm, 0xd60004)
  40.     ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique para participar no sorteio!", p, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
  41.     ui.addTextArea(-2, "<p align='center'><a href='event:credits'>Creditos", p, 21, 370, 60, 20, 1, 0x0000ff, 0.8, false)
  42.     ui.addTextArea(-5, "<p align='center'><a href='event:ajuda'>Ajuda?", p, 110, 370, 60, 20, 1, 0x0000ff, 0.8, false)
  43.     ui.addTextArea(-3, "<p align='center'><font size='30px'>"..nome, p, 5, 40, 795, 40, 1, 1, 0.8, false)
  44. end
  45.  
  46. function eventPopupAnswer(id, p, cmd)
  47.     if tonumber(cmd, 10) then
  48.         if tonumber(cmd, 10) >= 1 and tonumber(cmd, 10) <= #participante then
  49.             ui.removeTextArea(0, nil)
  50.             ui.removeTextArea(-1, nil)
  51.             qtd = tonumber(cmd, 10)
  52.             fast = math.random(5,15)
  53.             inicio = true
  54.         end
  55.     end
  56. end
  57.  
  58. function participando(p)
  59.     for i, v in pairs(participante) do
  60.         if v == p then
  61.             return true
  62.         end
  63.     end
  64.     return false
  65. end
  66.  
  67. function entrada(p, num)
  68.     ui.addTextArea(-2, "<p align='center'><a href='event:credits'>Creditos", nil, 21, 370, 60, 20, 1, 0x0000ff, 0.8, false)
  69.     ui.addTextArea(-5, "<p align='center'><a href='event:ajuda'>Ajuda?", nil, 110, 370, 60, 20, 1, 0x0000ff, 0.8, false)
  70.     if not participando(p) then
  71.         participante[num] = p
  72.         ui.addTextArea(num, "<p align='center'>" .. p, nil, ((num-1)%8)*100+5, math.floor((num-1)/8)*30+100, 90, 20, 1, 1, 0.8, false)
  73.     end
  74. end
  75.  
  76. function novo()
  77.     for i=1, #participante do
  78.         ui.removeTextArea(i, nil)
  79.         table.remove(participante, 1)
  80.     end
  81.     ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique para participar do sorteio!", nil, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
  82.     ui.addTextArea(-1, "<p align='center'><a href='event:inicio'>Iniciar", adm, 650, 370, 100, 20, 1, 0x0000ff, 0.8,false)
  83.     ui.addTextArea(-2, "<p align='center'><a href='event:credits'>Creditos", nil, 21, 370, 60, 20, 1, 0x0000ff, 0.8, false)
  84.     ui.addTextArea(-5, "<p align='center'><a href='event:ajuda'>Ajuda?", nil, 110, 370, 60, 20, 1, 0x0000ff, 0.8, false)
  85.     tfm.exec.removePhysicObject(0)
  86.     fim = false
  87. end
  88.  
  89. function sorteio(tipo)
  90.     local lista = {}
  91.     local sorteado = 0
  92.     for i=1, #participante do
  93.         lista[i] = i
  94.     end
  95.     local rand = 0
  96.     for i, v in pairs(participante) do
  97.         ui.addTextArea(i, "<p align='center'>" .. v, nil, ((i-1)%8)*100+5, math.floor((i-1)/8)*30+100, 90, 20, 1, 1, 0.8, false)
  98.     end
  99.     for i=1, qtd do
  100.         sorteado = math.random(#lista)
  101.         rand = lista[sorteado]
  102.         table.remove(lista, sorteado)
  103.         if tipo == "quase" then
  104.             ui.addTextArea(rand, "<p align='center'><font color='#ffff00'>" .. participante[rand], nil, ((rand-1)%8)*100+5, math.floor((rand-1)/8)*30+100, 90, 20, 1, 0xffff00, 0.8, false)
  105.         elseif tipo == "final" then
  106.             ui.addTextArea(rand, "<p align='center'><font color='#00ff00'><b>" .. participante[rand], nil, ((rand-1)%8)*100+5, math.floor((rand-1)/8)*30+100, 90, 20, 1, 0x00ff00, 0.8, false)
  107.         end
  108.     end
  109. end
  110.  
  111. function eventLoop()
  112.     if inicio then
  113.         if fast > 0 then
  114.             sorteio("quase")
  115.             fast = fast - 1
  116.         else
  117.             sorteio("final")
  118.             inicio = false
  119.             fim = true
  120.             ui.addTextArea(-1, "<p align='center'><a href='event:novo'>Novo sorteio", adm, 650, 370, 100, 20, 1, 0xd60004, 0.8,false)
  121.         end
  122.     end
  123.     if fim then
  124.         tfm.exec.displayParticle(math.random(21,24), math.random(1,800), 20, math.random(-20,20)/100, math.random(10,1000)/100, 0, 0, nil)
  125.         tfm.exec.displayParticle(math.random(21,24), math.random(1,800), 20, math.random(-20,20)/100, math.random(10,1000)/100, 0, 0, nil)
  126.         tfm.exec.displayParticle(math.random(21,24), math.random(1,800), 20, math.random(-20,20)/100, math.random(10,1000)/100, 0, 0, nil)
  127.     end
  128. end
  129.  
  130. function eventPlayerDied(playerName)
  131.         tfm.exec.respawnPlayer(playerName)
  132. end
  133.  
  134. tfm.exec.newGame(mapa)
  135. ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique para participar no sorteio!", nil, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
  136. ui.addTextArea(-2, "<p align='center'><a href='event:credits'>Creditos", nil, 21, 370, 60, 20, 1, 0x0000ff, 0.8, false)
  137. ui.addTextArea(-5, "<p align='center'><a href='event:ajuda'>Ajuda?", nil, 110, 370, 60, 20, 1, 0x0000ff, 0.8, false)
  138. ui.addTextArea(-1, "<p align='center'><a href='event:inicio'>Iniciar", adm, 650, 370, 100, 20, 1, 0xd60004, 0.8,false)
  139. ui.addTextArea(-3, "<p align='center'><font size='30px'>"..nome, nil, 5, 40, 795, 40, 1, 1, 0.8, false)
  140. tfm.exec.setUIMapName("Sala de Sorteios")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement