Advertisement
Dudugz-Contistente

Untitled

Oct 2nd, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. data={}
  2. maps={7162824,7233571}
  3.  
  4. freezer=""
  5.  
  6. tfm.exec.disableAutoShaman()
  7. tfm.exec.disableAutoNewGame()
  8.  
  9. getAlives=function()
  10. local a = 0 table.foreach(tfm.get.room.playerList, function(k,v) if not v.isDead and freezer ~= k then a=a+1 end end)
  11. end
  12.  
  13. function eventKeyboard(name,key,down,x,y)
  14. if key == 32 and name == freezer and data[name].cooldown < os.time()-2000 then
  15. local m = 0
  16. table.foreach(tfm.get.room.playerList,function(k,player)
  17. if m == 0 and name ~= k and x >= player.x - 15 and x <= player.x + 15 and y >= player.y - 15 and y <= player.y + 15 then
  18. tfm.exec.killPlayer(k)
  19. data[k].id=tfm.exec.addImage("15eda796ea2.png","!"..player.id,player.x-20,player.y-20)
  20. data[k].freezed=true
  21. data[k].cooldown_dead = 20
  22. data[name].cooldown=os.time()
  23. m=1
  24. end
  25. end)
  26. end
  27.  
  28. if key == 32 and name ~= freezer and not tfm.get.room.playerList[name].isDead and data[name].cooldown < os.time()-1000 then
  29. table.foreach(tfm.get.room.playerList,function(k,player)
  30. if data[k].cooldown_dead > 0 and name ~= k and data[k].freezed and not data[name].freezed and x >= player.x - 15 and x <= player.x + 15 and y >= player.y - 15 and y <= player.y + 15 then
  31. tfm.exec.respawnPlayer(k)
  32. tfm.exec.movePlayer(k,player.x,player.y)
  33. tfm.exec.removeImage(data[k].id)
  34. data[k].freezed=false
  35. ui.removeTextArea(player.id)
  36. data[name].cooldown=os.time()
  37. end
  38. end)
  39. end
  40. end
  41.  
  42. function eventNewGame()
  43. freezer=""
  44.  
  45. table.foreach(tfm.get.room.playerList,function(k,v)
  46. ui.removeTextArea(v.id,nil)
  47. tfm.exec.removeImage(data[k].id)
  48. data[k].cooldown_dead=0
  49. end)
  50. end
  51.  
  52. function check()
  53. table.foreach(tfm.get.room.playerList,function(k,v)
  54. if v.isDead then
  55. if data[k].cooldown_dead > 0 then
  56. ui.addTextArea(v.id,'<B><font color="#2F7FCC" size="13">'..math.floor(data[k].cooldown_dead/2),nil,v.x,v.y,30,30,0,0,0,true)
  57. data[k].cooldown_dead=data[k].cooldown_dead-1
  58. else
  59. ui.removeTextArea(v.id)
  60. v.isDead=false
  61. end
  62. end
  63. end)
  64. end
  65.  
  66. function eventLoop(t,r)
  67. if t > 4000 then
  68. if freezer == "" then
  69. local p = {} table.foreach(tfm.get.room.playerList,function(k,v) tfm.exec.setNameColor(k,0) table.insert(p,k) end)
  70. freezer = p[math.random(#p)]
  71. tfm.exec.setNameColor(freezer,0xFFCC00)
  72. data[freezer].cooldown=os.time();
  73. end
  74.  
  75. if tfm.get.room.playerList[freezer].isDead then
  76. for name,v in pairs(tfm.get.room.playerList) do if not v.isDead then tfm.exec.giveCheese(name)tfm.exec.playerVictory(name) end end
  77. tfm.exec.chatMessage("<FC>O freezer "..freezer.." morreu, os ratos vivos ganharam.</FC>")
  78. tfm.exec.newGame(maps[math.random(#maps)])
  79. end
  80.  
  81. if r <= 1000 then
  82. tfm.exec.chatMessage("<FC>O tempo acabou.</FC>")
  83. tfm.exec.newGame(maps[math.random(#maps)])
  84. end
  85.  
  86. if getAlives() == 0 then
  87. for name,v in pairs(tfm.get.room.playerList) do if not v.isDead then tfm.exec.giveCheese(name)tfm.exec.playerVictory(name) end end
  88. tfm.exec.chatMessage("<FC>O freezer "..freezer.." ganhou.</FC>")
  89. tfm.exec.newGame(maps[math.random(#maps)])
  90. end
  91.  
  92. check()
  93. end
  94. end
  95.  
  96. function eventNewPlayer(name)
  97. data[name]={
  98. id=nil,
  99. freezed=false,
  100. cooldown=0,
  101. cooldown_dead=0
  102. }
  103.  
  104. system.bindKeyboard(name,32,true)
  105. end
  106.  
  107. table.foreach(tfm.get.room.playerList,eventNewPlayer)
  108. tfm.exec.newGame(maps[math.random(#maps)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement