Advertisement
Thetroz

[Reto] Sobrevivir

Oct 2nd, 2016
612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.83 KB | None | 0 0
  1. local map = {'<C><P G="-10,10" /><Z><S><S P="0,0,0.3,0.2,0,0,0,0" X="111" L="119" H="10" c="3" Y="386" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" X="504" L="119" H="10" c="3" Y="369" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" X="330" L="119" H="10" c="3" Y="398" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" X="329" L="119" H="10" c="3" Y="323" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" X="267" L="119" H="10" c="3" Y="177" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" X="714" L="119" H="10" c="3" Y="328" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" X="186" L="119" H="10" c="3" Y="262" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" X="505" L="119" H="10" c="3" Y="189" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" X="510" L="119" H="10" c="3" Y="280" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" X="725" L="119" H="10" c="3" Y="218" T="0" /></S><D /><O /></Z></C>'}
  2. local mice = {}
  3. local ganadores = {}
  4. local ganadores_name = {}
  5. local contador_ganadores = 0
  6. local contador = 0
  7. local contador_in = 5
  8. local manzanas = false
  9. local timer = 7
  10.  
  11. function eventLoop()
  12.     contador_in = contador_in - 0.5
  13.     timer = timer + 0.5
  14.     if contador_in > -1 then
  15.         ui.addTextArea(0, "<p align='center'><b><font size='18'>Preparados...Empezamos en <v>"..math.ceil(contador_in).."", nil, 270, 27, 300, 50, 0x003366, 0x000000, 1)
  16.     end
  17.     if contador_in == -1 then
  18.         ui.addTextArea(0, "<p align='center'><b><font size='18'>¡Sobrevive!", nil, 270, 27, 300, 50, 0x003366, 0x000000, 1)
  19.         manzanas_s()
  20.     end
  21.     if manzanas == true then
  22.         tfm.exec.addShamanObject(10, 750, math.random(0,400), 0, -15, 0, false)
  23.     end
  24.     if timer == 5 then
  25.         manzanas = true
  26.     end
  27.     ui.addTextArea(1, "<b><font size='14' color='#000'><p align='center'>Personas que finalizaron el reto.</p><br>"..table.concat(ganadores, "<br>").."", nil, 13, 27, 150, 200, 0x0099ff, 0x000000, 0.5, true)
  28. end
  29.  
  30. function manzanas_s()
  31.     tfm.exec.disableAutoShaman(true)
  32.                 tfm.exec.disableAutoNewGame(true)
  33.             tfm.exec.disableAutoTimeLeft(true)
  34.     tfm.exec.newGame(map[1])
  35.                 tfm.exec.killPlayer(ganadores_name[1])
  36.                 tfm.exec.killPlayer(ganadores_name[2])
  37.                 tfm.exec.killPlayer(ganadores_name[3])
  38. end
  39.  
  40. function eventPlayerDied(name)
  41.     local jugadores = 0
  42.         for name in pairs(tfm.get.room.playerList) do
  43.             if tfm.get.room.playerList[name].isDead then
  44.             else
  45.             jugadores = jugadores + 1
  46.             end
  47.         end
  48.         if jugadores == 1 then
  49.             ganar()
  50.         end
  51. end
  52.  
  53. function ganar()
  54.         for name in pairs(tfm.get.room.playerList) do
  55.             if tfm.get.room.playerList[name].isDead then
  56.             else
  57.             contador = contador + 1
  58.             table.insert(ganadores, "<n><font color='#000'>"..contador..". "..name.."")
  59.             table.insert(ganadores_name, name)
  60.             contador_ganadores = contador_ganadores + 1
  61.             if contador_ganadores == 3 then
  62.             manzanas = false
  63.             else
  64.             for name in pairs(tfm.get.room.playerList) do
  65.                 tfm.exec.killPlayer(name)
  66.             end
  67.             contador_in = 5
  68.             end
  69.         end
  70. end
  71. end
  72.  
  73. function eventNewGame()
  74. timer = 0
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement