Advertisement
Dudugz-Contistente

Untitled

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