Advertisement
Flyingwr

[Script] Hardcore Survivor

Oct 21st, 2017
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. local shaman = ''
  2. local players = {}
  3. local cns = {}
  4. local canspawnobject = true
  5.  
  6. for k, v in next, {"AutoNewGame", "AutoShaman", "AfkDeath", "AutoTimeLeft", "AllShamanSkills"} do
  7.     tfm.exec['disable' .. v]()
  8. end
  9.  
  10. tfm.exec.newGame('#10')
  11.  
  12. function eventNewGame()
  13.     players = {}
  14.     for k in next, tfm.get.room.playerList do
  15.         players[#players + 1] = k
  16.     end
  17.  
  18.     if (#players > 1) then
  19.         if (shaman ~= '') then
  20.             local shaman2 = shaman
  21.             repeat
  22.                 shaman = players[math.random(#players)]
  23.             until
  24.                 shaman ~= shaman2
  25.         else
  26.             shaman = players[math.random(#players)]
  27.         end
  28.         tfm.exec.setShaman(shaman)
  29.     end
  30. end
  31.  
  32. function eventSummoningStart(name, id, x, y, angle)
  33.     if (canspawnobject) then
  34.         if (id == 17 or id == 1701 or id == 1702 or id == 1703 or id == 1704) then
  35.             for i = 1, 2 do
  36.                 local id = tfm.exec.addShamanObject(id, x, y, angle)
  37.                 cns[#cns + 1] = {id, os.time()}
  38.             end
  39.         elseif (id == 24) then
  40.             for i = 1, 15 do
  41.                 for i = 1, 3 do
  42.                     tfm.exec.explosion(x, y, 5000000, 150, false)
  43.                 end
  44.             end
  45.         end
  46.     end
  47. end
  48.  
  49. function eventLoop(elapsed, remaining)
  50.     local elapsed, remaining = math.floor(elapsed/1000), math.floor(remaining/1000)
  51.  
  52.     for k, v in ipairs(cns) do
  53.         if (v[2] <= os.time()-2500) then
  54.             tfm.exec.removeObject(v[1])
  55.             table.remove(cns, k)
  56.         end
  57.     end
  58.  
  59.     if (remaining <= 0) then
  60.         tfm.exec.newGame('#10')
  61.     end
  62. end
  63.  
  64. function eventPlayerDied(name)
  65.     local a = 0
  66.     for k, v in next, tfm.get.room.playerList do
  67.         if (not v.isShaman and not v.isDead) then
  68.             a = a + 1
  69.         end
  70.     end
  71.     if (a == 0) then
  72.         tfm.exec.setGameTime(5, false)
  73.         canspawnobject = false
  74.     end
  75.  
  76.     if (shaman == name) then
  77.         for k, v in next, tfm.get.room.playerList do
  78.             tfm.exec.giveCheese(k)
  79.             tfm.exec.playerVictory(k)
  80.         end
  81.         tfm.exec.setGameTime(5, false)
  82.     end
  83. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement