Advertisement
Dudugz-Contistente

Untitled

Sep 7th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.52 KB | None | 0 0
  1. tfm.exec.disableAutoShaman(true)
  2. tfm.exec.disableAutoNewGame(true)
  3. tfm.exec.disableAfkDeath(true)
  4. tfm.exec.disableAutoTimeLeft(true)
  5. tfm.exec.disableAutoScore(true)
  6. ui.setMapName("<font color='#FFE300'>Mice<font color='#0070FF'> Mania")
  7.  
  8.  
  9. data = {}
  10. p = {}
  11. local sonic = {}
  12. local knucles = {}
  13. local tails = {}
  14. local voando = {}
  15. local planar = {}
  16. time = os.time();
  17.  
  18. function eventNewPlayer(name)
  19. table.insert(p,name)
  20. data[name] = {
  21. life = 3,
  22. wins = 0,
  23. dead = 0,
  24. rodada = 0,
  25. xp = 0,
  26. level = 0,
  27. time = 0,
  28. }
  29. --anel(name)
  30. status(name)
  31. for keys, k in pairs({32,17,83,87,38,40}) do
  32. tfm.exec.bindKeyboard(name,k,true,true)
  33. end
  34. ui.addTextArea(0,"",name,4,28,127,20,0x986742, 0x986742,1,true)
  35. ui.addTextArea(1,"<font size='11'><font face='Arial'>Espaço Para Mover-se",name,5,29,125,18,0x171311, 0x171311,1,true)
  36. ui.addTextArea(4,"eae",name,660,380,135,20,0x986742, 0x986742,1,true)
  37. ui.addTextArea(5,"<font size='12'><font face='Arial'>Personagem : - -",name,661,381,133,18,0x171311, 0x171311,1,true)
  38. ui.addTextArea(6,"ae",name,284,28,188,20,0x986742, 0x986742,1,true)
  39. ui.addTextArea(7,"<font size='15'><font face='Arial'><a href='event:escolha'> Escolha seu Personagem :",name,285,29,186,18,0x171311,0x171311,1,true)
  40. ui.addTextArea(15,"ae",name,741,28,55,20,0x986742, 0x986742,1,true)
  41. ui.addTextArea(16,"<font size='15'><font face='Arial'><a href='event:Perfil'> Perfil",name,742,29,53,18,0x171311, 0x171311,1,true)
  42. end
  43.  
  44. function status(name)
  45. ui.addTextArea(3,"<font size='45'><font face='Arial'><font color='#FF0000'>❤",name,-7,356,0,0,0,0,1,true)
  46. ui.addTextArea(2,"<font size='20'>X"..data[name].life.."",name,25,375,0,0,0,0,1,true)
  47. if data[name].life == 3 then
  48. tfm.exec.respawnPlayer(name)
  49. end
  50. if data[name].life == 2 then
  51. tfm.exec.respawnPlayer(name)
  52. end
  53. if data[name].life == 1 then
  54. tfm.exec.respawnPlayer(name)
  55. end
  56. end
  57.  
  58.  
  59. function subLife(name,life)
  60. data[name].life = data[name].life - life
  61. if data[name].life <= 0 then
  62. data[name].life = 0
  63. tfm.exec.killPlayer(name)
  64. end
  65. status(name)
  66. end
  67.  
  68. function eventPlayerLeft(name)
  69. local i = -1
  70. for _,nome in pairs(tfm.get.room.playerList) do
  71. if nome == name then
  72. i=_
  73. end
  74. end
  75. table.remove(tails,i)
  76. table.remove(sonic,i)
  77. table.remove(knucles,i)
  78. end
  79.  
  80. function eventPlayerDied(name)
  81. subLife(name,1)
  82. data[name].dead = data[name].dead + 1
  83. end
  84.  
  85. function eventPlayerWon(name)
  86. SubLevel(name,math.random(5,20))
  87. data[name].wins = data[name].wins + 1
  88. end
  89.  
  90. function eventNewGame()
  91. for i,v in pairs(tfm.get.room.playerList) do
  92. data[i].rodada = data[i].rodada + 1
  93. end
  94. end
  95.  
  96. function eventTextAreaCallback(id,name,call)
  97. if call == "escolha" then
  98. ui.addTextArea(8,"",name,4,26,792,400,1,1,80,true)
  99. ui.addTextArea(9,"",name,234,144,130,30,0x986742, 0x986742,1,true)
  100. ui.addTextArea(10,"<font size='20'><font face='Arial'><a href='event:Sonic'> Sonic",name,235,145,128,28,0x171311, 0x171311,1,true)
  101. ui.addTextArea(11,"",name,425,144,130,30,0x986742, 0x986742,1,true)
  102. ui.addTextArea(12,"<font size='20'><font face='Arial'><a href='event:Tails'> Tails",name,426,145,128,28,0x171311, 0x171311,1,true)
  103. ui.addTextArea(13,"",name,330,224,130,30,0x986742, 0x986742,1,true)
  104. ui.addTextArea(14,"<font size='20'><font face='Arial'><a href='event:Knucles'> Knuckles",name,331,225,128,28,0x171311, 0x171311,1,true)
  105. for id=6,7 do
  106. ui.removeTextArea(id,name)
  107. end
  108. end
  109. if call == "Sonic" then
  110. table.insert(sonic,name)
  111. tfm.exec.setNameColor(name,0x005EFF)
  112. ui.addTextArea(5,"<font size='12'><font face='Arial'>Personagem :<font size='12' color='#005EFF'> Sonic",name,661,381,133,18,0x171311, 0x171311,1,true)
  113. for id=8,14 do
  114. ui.removeTextArea(id,name)
  115. end
  116. end
  117. if call == "Tails" then
  118. table.insert(tails,name)
  119. tfm.exec.setNameColor(name,0xFFD100)
  120. ui.addTextArea(5,"<font size='12'><font face='Arial'>Personagem :<font size='12' color='#FFD100'> Tails",name,661,381,133,18,0x171311, 0x171311,1,true)
  121. for id=8,14 do
  122. ui.removeTextArea(id,name)
  123. end
  124. end
  125. if call == "Perfil" then
  126. nome = name
  127. if tfm.get.room.playerList[nome] then
  128. this = tfm.get.room.playerList[nome]
  129. ui.addTextArea(19,"",name,240,92,350,180,0x183942,0x29434A,1,true)
  130. ui.addTextArea(20,"<font size='20' face='Impact'><p align='center'><V>"..nome,name,308,102,215,30,0x1D434D,0x1D434D,0.5,true)
  131. ui.addTextArea(21,"<font size='12'><p align='center'>Comunidade : <V>"..this.community:lower():gsub('%a',string.upper,1).."</font>",name,308,145,215,20,0x1D434D,0x1D434D,0,true)
  132. ui.addTextArea(22,"<font size='15'><p align='center'>Vitórias: "..data[nome].wins.."\nMortes: "..data[nome].dead.."\nRodadas: "..data[nome].rodada.."",name,250,190,330,62,0x1D434D,0x1D434D,1,true)
  133. ui.addTextArea(23,"<p align='center'><a href='event:close'>Fechar",name,250,285,330,20,0x153139,0x132C33,1,true)
  134. ui.addTextArea(24,"",name,253,161,100,20,0x00889A,0x00889A,1,true)
  135. levelp(nome,name)
  136. else
  137. ui.addPopup(0,3,"<font size ='14' color='#FF00DE'>[•]</font><font color='#FED000' size='14'> O Jogador <font color='#00F9FE'>"..nome.."</font> Ele não se Encontra na Sala.",name,300,200,300,true)
  138. end
  139. end
  140. if call == "close" then
  141. for id=19,27 do
  142. ui.removeTextArea(id,name)
  143. end
  144. end
  145. if call == "Knucles" then
  146. table.insert(knucles,name)
  147. tfm.exec.setNameColor(name,0xFF0000)
  148. ui.addTextArea(5,"<font size='12'><font face='Arial'>Personagem :<font size='11' color='#FF0000'> Knuckles",name,661,381,133,18,0x171311, 0x171311,1,true)
  149. for id=8,14 do
  150. ui.removeTextArea(id,name)
  151. end
  152. end
  153. end
  154.  
  155. function split(t,s)
  156. local a={}
  157. for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  158. table.insert(a,i)
  159. end
  160. return a
  161. end
  162.  
  163. function eventChatCommand(name,cmd)
  164. local arg = split(cmd, " ")
  165. if arg[1] == "p" then
  166. if arg[2] then
  167. nome = arg[2]:lower():gsub('%a', string.upper, 1)
  168. else
  169. nome = name
  170. end
  171. if tfm.get.room.playerList[nome] then
  172. this = tfm.get.room.playerList[nome]
  173. ui.addTextArea(19,"",name,240,92,350,180,0x183942,0x29434A,1,true)
  174. ui.addTextArea(20,"<font size='20' face='Impact'><p align='center'><V>"..nome,name,308,102,215,30,0x1D434D,0x1D434D,0.5,true)
  175. ui.addTextArea(21,"<font size='12'><p align='center'>Comunidade : <V>"..this.community:lower():gsub('%a',string.upper,1).."</font>",name,308,145,215,20,0x1D434D,0x1D434D,0,true)
  176. ui.addTextArea(22,"<font size='15'><p align='center'>Vitórias: "..data[nome].wins.."\nMortes: "..data[nome].dead.."\nRodadas: "..data[nome].rodada.."",name,250,190,330,62,0x1D434D,0x1D434D,1,true)
  177. ui.addTextArea(23,"<p align='center'><a href='event:close'>Fechar",name,250,285,330,20,0x153139,0x132C33,1,true)
  178. ui.addTextArea(24,"",name,253,161,100,20,0x00889A,0x00889A,1,true)
  179. levelp(nome,name)
  180. else
  181. ui.addPopup(0,3,"<font size ='14' color='#FF00DE'>[•]</font><font color='#FED000' size='14'> O Jogador <font color='#00F9FE'>"..nome.."</font> Ele não se Encontra na Sala.",name,300,200,300,true)
  182. end
  183. end
  184. end
  185.  
  186. function levelp(nome,name)
  187. ui.addTextArea(25,"<font color='#FFEF00'>Level: "..data[nome].level.."",name,253,141,0,0,0x00000,0x00000,1,true)
  188. ui.addTextArea(26,"",name,253,161,data[nome].xp,20,0x01CAE6,0x01CAE6,1,true)
  189. ui.addTextArea(27,"<font color='#FFEF00'>Xp: "..data[nome].xp.."/100",name,273,161,0,0,0x00000,0x00000,1,true)
  190. end
  191.  
  192. function SubLevel(name,xp)
  193. data[name].xp = data[name].xp + xp
  194. if data[name].xp >= 100 then
  195. data[name].xp = 100
  196. data[name].level = data[name].level + 1
  197. data[name].xp = data[name].xp - 100
  198. end
  199. end
  200.  
  201. function eventKeyboard(name, key, down, x, y)
  202. if key == 32 and not tfm.get.room.playerList[name].isDead then
  203. for _,nome in pairs(sonic) do
  204. if nome == name then
  205. if tfm.get.room.playerList[name].isFacingRight then
  206. tfm.exec.movePlayer(name,0,0,true,50,0,true)
  207. tfm.exec.displayParticle(9,x,y,math.random(-1.1),vx,math.random(1.-1),ay,nil)
  208. else
  209. tfm.exec.movePlayer(name,0,0,true,-50,0,true)
  210. tfm.exec.displayParticle(9,x,y,math.random(-1.1),vx,math.random(1.-1),ay,nil)
  211. end
  212. end
  213. end
  214. end
  215.  
  216. if key == 32 and not tfm.get.room.playerList[name].isDead then
  217. for _,nome in pairs(tails) do
  218. if nome == name then
  219. table.insert(voando,name)
  220. tfm.exec.displayParticle(2,x,y,math.random(0.15),math.random(-0.5),0,-5,nil)
  221. end
  222. end
  223. end
  224.  
  225. if (key == 83 or key == 40) then
  226. local i = -1
  227. for _,nome in pairs(voando) do
  228. if nome == name then
  229. i=_
  230. end
  231. end
  232. table.remove(voando,i)
  233. end
  234. if key == 32 and not tfm.get.room.playerList[name].isDead then
  235. if data[name].time < os.time()-500 then
  236. for _,nome in pairs(knucles) do
  237. if nome == name then
  238. if y < 200 then
  239. if tfm.get.room.playerList[name].isFacingRight then
  240. tfm.exec.displayParticle(13,x,y,math.random(-1.1),vx,math.random(1.-1),ay,nil)
  241. tfm.exec.movePlayer(name,0,0,false,0,-12,true)
  242. tfm.exec.movePlayer(name,0,0,false,0,-14,true)
  243. else
  244. tfm.exec.displayParticle(13,x,y,math.random(-1.1),vx,math.random(1.-1),ay,nil)
  245. tfm.exec.movePlayer(name,0,0,false,0,-12,true)
  246. tfm.exec.movePlayer(name,0,0,false,0,-14,true)
  247.  
  248. data[name].time = os.time();
  249. end
  250. end
  251. end
  252. end
  253. end
  254. end
  255. end
  256.  
  257. function eventLoop()
  258. for _,nome in pairs(voando) do
  259. tfm.exec.movePlayer(nome,0,0,true,0,-70,true)
  260. end
  261. for i,v in pairs(tfm.get.room.playerList) do
  262. if v.y < 48 then
  263. tfm.exec.movePlayer(i, 0, 0, false, 0, 150, true)
  264. tfm.exec.movePlayer(i, 0, 0, false, math.random(-100,100), 0, true)
  265. end
  266. end
  267. end
  268.  
  269. for i,v in pairs(tfm.get.room.playerList) do
  270. eventNewPlayer(i)
  271. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement