Advertisement
Dudugz-Contistente

Untitled

Dec 4th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.11 KB | None | 0 0
  1. p={}
  2.  
  3. tnt = 0
  4.  
  5. mapas = {6857760,6859036,6844027,6956808}
  6.  
  7. time = os.time();
  8.  
  9. tfm.exec.disableAutoShaman(true)
  10. tfm.exec.disableAutoNewGame(true)
  11.  
  12. function split(t,s)
  13. local a={}
  14. for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  15. table.insert(a,i)
  16. end
  17. return a
  18. end
  19.  
  20.  
  21. function eventNewGame()
  22. setNewMouse()
  23. tnt = 20
  24. passar = os.time();
  25.  
  26. vivos = 0
  27.  
  28. tfm.exec.setGameTime(300)
  29.  
  30. for i in pairs(tfm.get.room.playerList) do
  31. p[i].life = 100
  32. ui.addTextArea(1,"",i,6,30,math.floor(p[i].life*2),16,0x00EE00,0x00CD00,70,true)
  33. ui.addTextArea(2,"<p align='center'><R>"..p[i].life.."/100",i,6,30,200,16,0,0,0,true)
  34. tfm.exec.setPlayerScore(i,p[i].life,false)
  35. vivos = vivos+1;
  36. end
  37.  
  38. end
  39.  
  40. function eventNewPlayer(name)
  41. p[name]={
  42. life = 100
  43. }
  44.  
  45. tfm.exec.bindKeyboard(name,32,true)
  46.  
  47. tfm.exec.setPlayerScore(name,p[name].life,false)
  48. ui.addTextArea(0,"",name,6,30,200,16,0x00CD00,0x00CD00,90,true)
  49. ui.addTextArea(1,"",name,6,30,math.floor(p[name].life*2),16,0x00EE00,0x00CD00,70,true)
  50. ui.addTextArea(2,"<p align='center'><R>"..p[name].life.."/100",name,6,30,200,16,0,0,0,true)
  51.  
  52. tfm.exec.chatMessage("• <V>[GAME]</V> <CE>Bem-vindo ao The infected mouse.</CE>",name)
  53. tfm.exec.chatMessage("• <V>[GAME]</V> <VP>Este minigame está em versão de tests.</VP>",name)
  54. end
  55.  
  56. for all in pairs(tfm.get.room.playerList) do
  57. eventNewPlayer(all)
  58. end
  59.  
  60. function eventChatMessage(name,message)
  61. local arg = split(message, " ")
  62.  
  63. end
  64.  
  65. function eventKeyboard(name, key, down, x, y)
  66. if key == 32 and passar < os.time()-1000 then
  67. if name == mouse then
  68. for target, player in pairs(tfm.get.room.playerList) do
  69. if (target ~= name) and not player.isDead then
  70. if x >= player.x - 15 and x <= player.x + 15 and y >= player.y - 15 and y <= player.y + 15 then
  71. setNewMouse(target)
  72. passar = os.time();
  73. break
  74. end
  75. end
  76. end
  77. end
  78. end
  79. end
  80.  
  81. function eventLoop(t,r)
  82. if t >= 3000 and time < os.time()-8000 then
  83. verefy()
  84. time = os.time();
  85. end
  86.  
  87. tfm.exec.setNameColor(mouse, 0xFFCC00)
  88.  
  89. if t >= 3000 and tnt >= 0 then
  90. ui.addTextArea(5,"<J><B><p align='center'><font size='15'>"..math.floor(tnt/2).."</font></p></J>",name,400,370,40,25,nil,0x6a8495,70,true)
  91. tnt = tnt-1;
  92. p[mouse].life = p[mouse].life-1;
  93. ui.addTextArea(1,"",mouse,6,30,math.floor(p[mouse].life*2),16,0x00EE00,0x00CD00,70,true)
  94. ui.addTextArea(2,"<p align='center'><R>"..p[mouse].life.."/100",mouse,6,30,200,16,0,0,0,true)
  95. tfm.exec.setPlayerScore(mouse,p[mouse].life,false)
  96. if p[mouse].life < 1 then
  97. tfm.exec.killPlayer(mouse)
  98. end
  99. end
  100.  
  101. if t >= 3000 and tnt == 0 then
  102. if not tfm.get.room.playerList[mouse].isDead then
  103. p[mouse].life = p[mouse].life-math.random(5,15)
  104. ui.addTextArea(1,"",mouse,6,30,math.floor(p[mouse].life*2),16,0x00EE00,0x00CD00,70,true)
  105. ui.addTextArea(2,"<p align='center'><R>"..p[mouse].life.."/100",mouse,6,30,200,16,0,0,0,true)
  106.  
  107. tfm.exec.setPlayerScore(mouse,p[mouse].life,false)
  108.  
  109. if p[mouse].life < 1 then
  110. tfm.exec.killPlayer(mouse)
  111. end
  112. end
  113.  
  114. setNewMouse();
  115.  
  116. tnt = 20;
  117. end
  118. if mouse ~= "" then
  119. if p[mouse].life < 1 then
  120. setNewMouse();
  121. tnt = 20;
  122. end
  123.  
  124. local particles = {2, 13}
  125. for i = 1, 3 do
  126. tfm.exec.displayParticle(particles[math.random(#particles)], tfm.get.room.playerList[mouse].x, tfm.get.room.playerList[mouse].y - math.random(5, 15), math.random(-2, 2), math.random(-2, 2))
  127. end
  128. end
  129. end
  130.  
  131. function verefy()
  132. for i,v in pairs(tfm.get.room.playerList) do
  133.  
  134. if p[i].life < 100 and mouse ~= i and not tfm.get.room.playerList[i].isDead then
  135.  
  136. p[i].life = p[i].life+math.random(3,8)
  137. ui.addTextArea(1,"",i,6,30,math.floor(p[i].life*2),16,0x00EE00,0x00CD00,70,true)
  138. ui.addTextArea(2,"<p align='center'><R>"..p[i].life.."/100",i,6,30,200,16,0,0,0,true)
  139. end
  140.  
  141. if p[i].life > 100 then
  142. p[i].life = 100
  143. ui.addTextArea(1,"",i,6,30,math.floor(p[i].life*2),16,0x00EE00,0x00CD00,70,true)
  144. ui.addTextArea(2,"<p align='center'><R>"..p[i].life.."/100",i,6,30,200,16,0,0,0,true)
  145. end
  146.  
  147. tfm.exec.setPlayerScore(i,p[i].life,false)
  148. end
  149. end
  150.  
  151.  
  152. function eventPlayerDied(name)
  153. p[name].life = 0
  154. ui.addTextArea(1,"",name,6,30,math.floor(p[name].life*2),16,0,0,0,true)
  155. ui.addTextArea(2,"<p align='center'><font color='#EE2C2C'><font size='18'>☠",name,6,25,200,nil,0,0,0,true)
  156. tfm.exec.setPlayerScore(name,p[name].life,false)
  157. p[name].life = 1
  158. vivos = vivos-1;
  159.  
  160. if vivos == 1 then
  161. for i in pairs(tfm.get.room.playerList) do
  162. if not tfm.get.room.playerList[i].isDead then
  163. tfm.exec.giveCheese(i)
  164. tfm.exec.playerVictory(i)
  165. tfm.exec.newGame(mapas[math.random(#mapas)])
  166. end
  167. end
  168. end
  169. end
  170.  
  171. function setNewMouse(name)
  172. jogadores = {}
  173.  
  174. for i in pairs(tfm.get.room.playerList) do
  175. if not tfm.get.room.playerList[i].isDead then
  176. table.insert(jogadores,i)
  177. tfm.exec.setNameColor(i, 0xFFFFFF)
  178. end
  179. end
  180.  
  181. if name == nil or name == "" then
  182. mouse = jogadores[math.random(#jogadores)]
  183. else
  184. mouse = name
  185. end
  186.  
  187. tfm.exec.chatMessage("• <V>[GAME]</V> <VP>"..mouse.."</VP> está infectado, cuidado!")
  188. end
  189.  
  190. tfm.exec.newGame(mapas[math.random(#mapas)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement