Advertisement
Dudugz-Contistente

Untitled

Oct 2nd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.45 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 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
  18. tfm.exec.killPlayer(k)
  19. data[k].coords = {player.x,player.y}
  20. data[k].id=tfm.exec.addImage("15eda796ea2.png","!"..player.id,data[k].coords[1]-20,data[k].coords[2]-20)
  21. data[k].freezed=true
  22. data[k].cooldown_dead = 20
  23. data[name].cooldown=os.time()
  24. m=1
  25. end
  26. end)
  27. end
  28.  
  29. if key == 32 and name ~= freezer and not tfm.get.room.playerList[name].isDead and data[name].cooldown < os.time()-1000 then
  30. table.foreach(tfm.get.room.playerList,function(k,player)
  31. 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
  32. tfm.exec.respawnPlayer(k)
  33. tfm.exec.movePlayer(k,data[k].coords[1],data[k].coords[2])
  34. tfm.exec.removeImage(data[k].id)
  35. data[k].freezed=false
  36. ui.removeTextArea(player.id)
  37. data[name].cooldown=os.time()
  38. end
  39. end)
  40. end
  41. end
  42.  
  43. function eventNewGame()
  44. freezer=""
  45.  
  46. table.foreach(tfm.get.room.playerList,function(k,v)
  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. end
  75.  
  76. if tfm.get.room.playerList[freezer].isDead then
  77. 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
  78. tfm.exec.chatMessage("<FC>O freezer "..freezer.." morreu, os ratos vivos ganharam.</FC>")
  79. tfm.exec.newGame(maps[math.random(#maps)])
  80. end
  81.  
  82. if r <= 1000 then
  83. tfm.exec.chatMessage("<FC>O tempo acabou.</FC>")
  84. tfm.exec.newGame(maps[math.random(#maps)])
  85. end
  86.  
  87. if getAlives() == 0 then
  88. 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
  89. tfm.exec.chatMessage("<FC>O freezer "..freezer.." ganhou.</FC>")
  90. tfm.exec.newGame(maps[math.random(#maps)])
  91. end
  92.  
  93. check()
  94. end
  95. end
  96.  
  97. function eventNewPlayer(name)
  98. data[name]={
  99. id=nil,
  100. freezed=false,
  101. cooldown=0,
  102. cooldown_dead=0
  103. }
  104.  
  105. system.bindKeyboard(name,32,true)
  106. end
  107.  
  108. table.foreach(tfm.get.room.playerList,eventNewPlayer)
  109. tfm.exec.newGame(maps[math.random(#maps)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement