Advertisement
Dudugz-Contistente

Untitled

Dec 8th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.34 KB | None | 0 0
  1. --Variaveis--
  2.  
  3. mapas = {6940835,6940872,6939230,6939743,6932947,6931137,6933370,6933386,6939573,6939693,6939230,6939558,6939573,6939583,6939322,6947704,6960338,6960316}
  4. shaman = ""
  5.  
  6. data = {}
  7.  
  8. p={}
  9.  
  10. time_click = 0;
  11. vivos = 0;
  12. message=false
  13. g_time = 0;
  14.  
  15. --Funções--
  16.  
  17. tfm.exec.disableAutoNewGame(true)
  18. tfm.exec.disableAutoTimeLeft(true)
  19. tfm.exec.disableAllShamanSkills(true)
  20.  
  21. textarea=ui.addTextArea
  22. function ui.addTextArea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss)
  23. --if not backgroundColor then backgroundColor=0x324650 end
  24. --if not borderColor then borderColor=0x000001 end
  25. if emboss then
  26. textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha)
  27. textarea(7979+id,"",targetPlayer,x,y-1,width,height,0x6A8FA2,0x6A8FA2,backgroundAlpha)
  28. end
  29. textarea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha)
  30. end
  31.  
  32. function split(t,s)
  33. local a={}
  34. for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  35. table.insert(a,i)
  36. end
  37. return a
  38. end
  39.  
  40.  
  41. function eventNewPlayer(name)
  42. system.bindMouse(name,true)
  43.  
  44. p[name]={
  45. rounds=0,
  46. Mwins=0,
  47. Swins=0,
  48. kills=0,
  49. killer=0,
  50. killsK=0,
  51. sp={
  52. strenght = 20,
  53. price = 25,
  54. },
  55. }
  56.  
  57. for i,v in pairs(data) do
  58. if v[1] == name then
  59. p[name] = v[2]
  60. end
  61. end
  62.  
  63. table.insert(data,{name, p[name]})
  64. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N><CE>Bem-vindo ao explosion v2.6</CE></N>",name)
  65. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N><J>Caso você não esteja vendo a explosão <br>vá em opções e ative os efeitos especiais.</J></N>",name)
  66. tfm.exec.chatMessage("<VP>→</VP> <V>[Help]</V> <B><J>Comandos:</J></B><br><BL>→</BL> <VP>!help</VP> - abre a janela de ajuda<br><BL>→</BL> <VP>!ajuda</VP> - abre a janela de ajuda<br><BL>→</BL> <VP>!p</VP> <J>[Nome]</J> - abre o perfil de um jogador, sem o nome abre o seu.",name)
  67. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N>Este minigame foi desenvolvido por <V>Contistente</V> & <V>Rianmojang</V>.</N>",name)
  68.  
  69. eventChatCommand(name,'help')
  70.  
  71.  
  72. if not game then
  73. tfm.exec.newGame(mapas[math.random(#mapas)])
  74. end
  75.  
  76.  
  77. end
  78.  
  79. function eventChatCommand(name, cmd)
  80. local arg = split(cmd, " ")
  81.  
  82. if arg[1] == "help" or arg[1] == "ajuda" then
  83. tfm.exec.chatMessage("<VP>→</VP> <V>[Help]</V> <J>Olhe a janela que abriu na sua tela.</J>",name)
  84. ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
  85. ui.addTextArea(1,'<B><J><font size="13">Como jogar',name,310,48,175,20,nil,0x324650,nil,true)
  86. ui.addTextArea(2,'<p align="center"><R><a href="event:close">X</a>',name,466,50,16,16,0x324650,0x324650,nil,true)
  87. ui.addTextArea(3,"<B><font size='12'>O jogo consiste em um shaman que é o <CE>Matador</CE> ele mata os ratos soltando <VP>explosões</VP> pelo mapa ao <VP>clickar na tela</VP>, e os <CE>Ratos</CE> precisam <R>sobreviver até o tempo acabar</R> para vencer.",name,305,85,190,250,0x0e232b,0x0e232b,nil,true)
  88. end
  89.  
  90. if arg[1] == "shop" then
  91. tfm.exec.chatMessage("<VP>→</VP> <V>[Shop]</V> <J>Olhe a janela que abriu na sua tela.</J>",name)
  92. ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
  93. ui.addTextArea(1,'<B><J><font size="13">Loja',name,310,48,175,20,nil,0x324650,nil,true)
  94. ui.addTextArea(2,'<p align="center"><R><a href="event:close">X</a>',name,466,50,16,16,0x324650,0x324650,nil,true)
  95. ui.addTextArea(3,"<B><font size='12'>",name,305,85,190,250,0x0e232b,0x0e232b,nil,true)
  96. end
  97.  
  98. if arg[1] == "p" then
  99. tfm.exec.chatMessage("<VP>→</VP> <V>[Profile]</V> <J>Olhe a janela que abriu na sua tela.</J>",name)
  100. if arg[2] then
  101. nome = arg[2]:lower():gsub('%a', string.upper, 1) -- guarda na variavel
  102. else
  103. nome = name
  104. end
  105.  
  106. if tfm.get.room.playerList[nome] then
  107. ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
  108. ui.addTextArea(1,'<B><J><font size="13">'..nome,name,310,48,175,20,nil,0x324650,nil,true)
  109. ui.addTextArea(2,'<p align="center"><R><a href="event:close">X</a>',name,466,50,16,16,0x324650,0x324650,nil,true)
  110. ui.addTextArea(3,"<B><font size='12'>Vezes Jogadas: "..p[nome].rounds.."<br>Vitórias como rato: "..p[nome].Mwins.."<br>Vitórias como matador: "..p[nome].Swins.."<br>Derrotas como rato: "..p[nome].kills.."<br>Derrotas como matador: "..p[nome].killsK.."<br>Vezes Matador: "..p[nome].killer.."",name,305,85,190,250,0x0e232b,0x0e232b,nil,true)
  111. else
  112. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <R>"..nome.." não se encontra em sala ou não existe.</R>",name)
  113. end
  114. end
  115.  
  116. end
  117.  
  118. function eventPlayerLeft(name)
  119. if name == shaman and game then
  120. newMap()
  121. end
  122. end
  123.  
  124. function newMap()
  125. tfm.exec.newGame(mapas[math.random(#mapas)])
  126. end
  127.  
  128. function eventNewGame()
  129. newShaman()
  130. time_click = 2;
  131. tfm.exec.setGameTime(100)
  132. tfm.exec.snow(100)
  133. end
  134.  
  135. function eventPlayerDied(name)
  136. vivos=vivos-1;
  137.  
  138. p[name].kills = p[name].kills+1;
  139.  
  140. if vivos == 1 and g_time > 30000 then
  141. tfm.exec.setGameTime(31)
  142. end
  143.  
  144. if vivos == 0 then
  145. jogadores={}
  146.  
  147. for i in pairs(tfm.get.room.playerList) do
  148. table.insert(jogadores,i)
  149. end
  150.  
  151. tfm.exec.setPlayerScore(jogadores[math.random(#jogadores)],16,false)
  152. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> O matador <VP>"..shaman.."</VP> é o vencedor.")
  153. p[shaman].Swins = p[shaman].Swins+1;
  154. newMap()
  155. end
  156. end
  157.  
  158. function newShaman()
  159. vivos=0
  160. for i,v in pairs(tfm.get.room.playerList) do
  161. if v.isShaman then
  162. shaman = i
  163. end
  164. vivos=vivos+1;
  165.  
  166. tfm.exec.giveMeep(i)
  167. end
  168.  
  169. if vivos > 2 then
  170. game = true
  171. for i in pairs(tfm.get.room.playerList) do
  172. p[i].rounds = p[i].rounds+1;
  173. end
  174. p[shaman].killer = p[shaman].killer+1;
  175. p[shaman].kills = p[shaman].kills-1;
  176. tfm.exec.killPlayer(shaman)
  177. tfm.exec.setPlayerScore(shaman,0,false)
  178. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N><CE>"..shaman.."</CE> é o matador.</N>")
  179. else
  180. game = false
  181. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N><R>É necessário 3 jogadores.</N>")
  182. end
  183. end
  184.  
  185. function eventMouse(name,x,y)
  186. if time_click == 0 and name == shaman and game then
  187. tfm.exec.explosion (x, y, p[name].sp.strenght, 100, true)
  188. tfm.exec.displayParticle(12,x,y)
  189. for i=1,25 do
  190. tfm.exec.displayParticle(0,x,y,math.random(-5,5),math.random(-5,5))
  191. end
  192. time_click = 3
  193. end
  194. end
  195.  
  196. function eventTextAreaCallback(id,name,link)
  197. if link=="close" then
  198. for id=0,30 do
  199. ui.removeTextArea(id,name)
  200. ui.removeTextArea(6969+id,name)
  201. ui.removeTextArea(7979+id,name)
  202. end
  203. end
  204. end
  205.  
  206. function eventLoop(t,r)
  207. g_time = r
  208. if t >= 3000 then
  209. if time_click > 0 and game then
  210. ui.addTextArea(8,'<p align="center"><B><VP>'..time_click,nil,6,380,20,20,0,0,0,true)
  211. time_click = time_click-1;
  212. elseif time_click == 0 then
  213. ui.removeTextArea(8,nil)
  214. end
  215.  
  216. if vivos == 0 then
  217. newMap()
  218. vivos=1
  219. end
  220. end
  221.  
  222. if r < 1000 then
  223. for i,v in pairs(tfm.get.room.playerList) do
  224. if not v.isDead and game then
  225. tfm.exec.giveCheese(i)
  226. tfm.exec.playerVictory(i)
  227. p[i].Mwins = p[i].Mwins+1;
  228. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <VP>"..i.."</VP> é o vencedor.")
  229. p[shaman].killsK = p[shaman].killsK+1;
  230. end
  231. end
  232.  
  233. vivos=vivos-1;
  234.  
  235. end
  236.  
  237. end
  238.  
  239. for all in pairs(tfm.get.room.playerList) do
  240. eventNewPlayer(all)
  241. end
  242.  
  243. tfm.exec.setRoomMaxPlayers(25)
  244. newMap()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement