Advertisement
Travonrodfer

Meteor

Nov 28th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.62 KB | None | 0 0
  1. m = 0
  2. t = 0
  3. n = 0
  4. local protect = {}
  5. local tiraescudo = {}
  6. local pool = {}
  7. local p = {}
  8.  
  9. for name in pairs(tfm.get.room.playerList) do
  10. p[name] = 1
  11. protect[name] = 3
  12. tiraescudo[name] = false
  13. end
  14.  
  15.  
  16. meteoro = {
  17. type = 13;
  18. width = 30;
  19. color = 0x000001;
  20. friction = 9999;
  21. restitution = 0;
  22. MouseCollision = true;
  23. GroundCollision = false;
  24. foreground = true;
  25. dynamic = true;
  26. mass = 9999;
  27. };
  28.  
  29. function eventKeyboard(name, key, p, x, y)
  30.     if key == 32 and protect[name] > 0 then
  31.         table.insert(pool, {tfm.exec.addPhysicObject(p, x, y - 30, {type=12, width=100, miceCollision = false,color=0xfff000, GroundCollision = true, angle = 10}), os.time()})
  32.         tiraescudo[name] = true
  33.         protect[name] = protect[name] - 1
  34.  
  35.     end
  36. end
  37.  
  38. for name in pairs(tfm.get.room.playerList) do
  39.     system.bindKeyboard(name, 32, true, true)
  40. end
  41.  
  42. function eventLoop()
  43.     n = n +1
  44.     m=m+.5
  45.     if tiraescudo[name] then
  46.         t=t+.5
  47.         elseif tiraescudo[name] and t >= 3 then
  48.             tiraescudo[name] = false
  49.             t = 0
  50.     end
  51.     if m == 1 then
  52.         tfm.exec.addPhysicObject(n, math.random(800.0), -200, meteoro)
  53.         elseif m == 2 then
  54.             tfm.exec.addPhysicObject(n, math.random(800.0), -200, meteoro)
  55.             m = 0
  56.     end
  57.     for i,v in ipairs(pool) do
  58.         if v[2] < os.time() - 3000 then
  59.             tfm.exec.removePhysicObject(p)
  60.             table.remove(pool, i)
  61.         end
  62.     end
  63. end
  64.  
  65. function eventPlayerWon(name)
  66.     tfm.exec.respawnPlayer(name)
  67. end
  68.  
  69. function eventPlayerDied(name)
  70.     tfm.exec.respawnPlayer(name)
  71.     protect[name] = 3
  72. end
  73.  
  74. function initial()
  75. dia = math.random(8)
  76.     if dia == 1 or dia == 2 or dia == 3 or dia == 5 or dia == 7 or dia == 8 then
  77.         xml = ('<C><P F="' .. dia .. '" aie="" /><Z><S><S P="0,0,0.3,0.2,0,0,0,0" L="800" X="400" c="3" Y="400" T="6" H="80" /><S P="0,0,0.3,0.2,0,0,0,0" L="720" H="20" c="3" Y="310" T="6" X="360" /><S P="0,0,0.3,0.2,0,0,0,0" L="720" X="440" c="3" Y="245" T="6" H="20" /><S P="0,0,0.3,0.2,0,0,0,0" L="720" H="20" c="3" Y="182" T="6" X="362" /><S P="0,0,0.3,0.2,0,0,0,0" L="720" X="441" c="3" Y="118" T="6" H="20" /><S P="0,0,0.3,0.2,0,0,0,0" L="720" H="20" c="3" Y="61" T="6" X="360" /><S P="0,0,0.3,0.2,180,0,0,0" L="800" H="80" c="3" Y="-40" T="6" X="400" /><S P="0,0,0,0,0,0,0,0" L="19" H="382" c="3" Y="184" T="14" X="-10" /><S P="0,0,0,0,0,0,0,0" L="19" X="809" c="3" Y="185" T="14" H="382" /></S><D><T Y="358" X="32" /><F Y="47" X="28" /></D><O /></Z></C>')
  78.         tfm.exec.disableAutoNewGame(true)
  79.         tfm.exec.disableAutoShaman(true)
  80.         tfm.exec.disableAfkDeath(true)
  81.         tfm.exec.disableAutoTimeLeft(true)
  82.         tfm.exec.newGame(xml)
  83.         tfm.exec.setGameTime(99999)
  84.         ui.setMapName("Meteor")
  85.     elseif dia == 4 or dia == 6 then
  86.         initial()
  87.     end
  88. end
  89. initial()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement