Advertisement
Dudugz-Contistente

Untitled

Oct 2nd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 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) return a
  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. for k,player in pairs(tfm.get.room.playerList) do
  16. if name ~= k and not player.isDead and not data[k].freezed and x >= player.x - 15 and x <= player.x + 15 and y >= player.y - 15 and y <= player.y + 15 then
  17. tfm.exec.killPlayer(k)
  18. data[k].coords = {player.x,player.y}
  19. data[k].id=tfm.exec.addImage("15eda796ea2.png","!"..player.id,data[k].coords[1]-20,data[k].coords[2]-20)
  20. data[k].freezed=true
  21. data[k].cooldown_dead = 20
  22. data[name].cooldown=os.time()
  23. break
  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()-2500 then
  29. table.foreach(tfm.get.room.playerList,function(k,player)
  30. if data[k].cooldown_dead > 0 and name ~= k and player.isDead 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,data[k].coords[1],data[k].coords[2])
  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. data[k].freezed=false
  47. ui.removeTextArea(v.id,nil)
  48. tfm.exec.removeImage(data[k].id)
  49. data[k].cooldown_dead=0
  50. end)
  51. end
  52.  
  53. function check()
  54. table.foreach(tfm.get.room.playerList,function(k,v)
  55. if v.isDead then
  56. if data[k].cooldown_dead > 0 then
  57. ui.addTextArea(v.id,'<B><font color="#2F7FCC" size="13">'..math.floor(data[k].cooldown_dead/2),nil,data[k].coords[1],data[k].coords[2],30,30,0,0,0,true)
  58. data[k].cooldown_dead=data[k].cooldown_dead-1
  59. else
  60. ui.removeTextArea(v.id)
  61. v.isDead=false
  62. end
  63. end
  64. end)
  65. end
  66.  
  67. function eventLoop(t,r)
  68. if t > 4000 then
  69. if freezer == "" then
  70. local p = {} table.foreach(tfm.get.room.playerList,function(k,v) tfm.exec.setNameColor(k,0) table.insert(p,k) end)
  71. freezer = p[math.random(#p)]
  72. tfm.exec.setNameColor(freezer,0xFFCC00)
  73. data[freezer].cooldown=os.time();
  74. tfm.exec.chatMessage("<V>"..freezer.."</V> é o freezer, cuidado.")
  75. end
  76.  
  77. if tfm.get.room.playerList[freezer].isDead then
  78. 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
  79. tfm.exec.chatMessage("<FC>O freezer "..freezer.." morreu, os ratos vivos ganharam.</FC>")
  80. tfm.exec.newGame(maps[math.random(#maps)])
  81. end
  82.  
  83. if r <= 1000 then
  84. tfm.exec.chatMessage("<FC>O tempo acabou.</FC>")
  85. tfm.exec.newGame(maps[math.random(#maps)])
  86. end
  87.  
  88. if getAlives() == 0 then
  89. 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
  90. tfm.exec.chatMessage("<FC>O freezer "..freezer.." ganhou.</FC>")
  91. tfm.exec.newGame(maps[math.random(#maps)])
  92. end
  93.  
  94. check()
  95. end
  96. end
  97.  
  98. function eventNewPlayer(name)
  99. data[name]={
  100. id=nil,
  101. freezed=false,
  102. cooldown=0,
  103. cooldown_dead=0
  104. }
  105.  
  106. system.bindKeyboard(name,32,true)
  107. end
  108.  
  109. table.foreach(tfm.get.room.playerList,eventNewPlayer)
  110. tfm.exec.newGame(maps[math.random(#maps)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement