Advertisement
Dudugz-Contistente

Untitled

Dec 11th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.50 KB | None | 0 0
  1. --Variaveis--
  2.  
  3. intervalMaps = {"@6964592"}
  4. mapas = {6940835,6940872,6939230,6939743,6932947,6931137,6933370,6933386,6939573,6939693,6939230,6939558,6939573,6939583,6939322,6947704,6960338,6960316,6961814,6954653}
  5. shaman = ""
  6.  
  7. data = {}
  8.  
  9. p={}
  10.  
  11. skip = 0
  12.  
  13. betaTesters = {"Contistente","Rianmojang","Brenower","Laagaadoo","Guhzumaki"}
  14.  
  15. time_click = 0;
  16. vivos = 0;
  17. message=false
  18. g_time = 0;
  19.  
  20. --Funções--
  21.  
  22. tfm.exec.disableAutoNewGame(true)
  23. tfm.exec.disableAutoTimeLeft(true)
  24. tfm.exec.disableAllShamanSkills(true)
  25.  
  26. textarea=ui.addTextArea
  27. function ui.addTextArea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss)
  28. --if not backgroundColor then backgroundColor=0x324650 end
  29. --if not borderColor then borderColor=0x000001 end
  30. if emboss then
  31. textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha)
  32. textarea(7979+id,"",targetPlayer,x,y-1,width,height,0x6A8FA2,0x6A8FA2,backgroundAlpha)
  33. end
  34. textarea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha)
  35. end
  36.  
  37. function split(t,s)
  38. local a={}
  39. for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  40. table.insert(a,i)
  41. end
  42. return a
  43. end
  44.  
  45.  
  46. function eventNewPlayer(name)
  47. system.bindMouse(name,true)
  48.  
  49. p[name]={
  50. rounds=0,
  51. Mwins=0,
  52. Swins=0,
  53. kills=0,
  54. killer=0,
  55. killsK=0,
  56. kSkip=0,
  57. lvl=1,
  58. sp=20,
  59. xp=0,
  60. mXp=50,
  61. skiped=false,
  62. }
  63.  
  64. for i,v in pairs(data) do
  65. if v[1] == name then
  66. p[name] = v[2]
  67. end
  68. end
  69.  
  70. table.insert(data,{name, p[name]})
  71. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N><CE>Bem-vindo ao explosion v2.7.7</CE></N>",name)
  72. 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)
  73. 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.<br><BL>→</BL> <VP>!r</VP> - abre o ranking.",name)
  74. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N>Este minigame foi desenvolvido por <V>Contistente</V> & <V>Rianmojang</V>.</N>",name)
  75. tfm.exec.chatMessage("<VP>→</VP> <ROSE>[Atenção]</ROSE> <VP>Olhe oque temos de novo no tópico:<br>http://atelier801.com/topic?f=6&t=839504</VP>",name)
  76. eventChatCommand(name,'help')
  77.  
  78.  
  79. if not game then
  80. tfm.exec.newGame(mapas[math.random(#mapas)])
  81. end
  82.  
  83.  
  84. end
  85.  
  86. function eventChatCommand(name, cmd)
  87. local arg = split(cmd, " ")
  88.  
  89. if arg[1] == "help" or arg[1] == "ajuda" then
  90. tfm.exec.chatMessage("<VP>→</VP> <V>[Help]</V> <J>Olhe a janela que abriu na sua tela.</J>",name)
  91. ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
  92. ui.addTextArea(1,'<B><J><font size="13">Como jogar',name,310,48,175,20,nil,0x324650,nil,true)
  93. ui.addTextArea(2,'<p align="center"><R><a href="event:close">X</a>',name,466,50,16,16,0x324650,0x324650,nil,true)
  94. ui.addTextArea(3,"<B><font size='12'>O jogo consiste em um shaman que é o <CE>Assassino</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)
  95. end
  96.  
  97. if arg[1] == "r" then
  98. eventRanking(name);
  99. end
  100.  
  101. if arg[1] == "skip" then
  102. if p[name].skiped then
  103. tfm.exec.chatMessage("<R>Você só pode dar skip uma vez por partida.</R>",name)
  104. else
  105. skip = skip+1;
  106. tfm.exec.chatMessage(name.." votou para trocar de assassino. ("..skip.."/"..math.floor(#p/2)..")")
  107. p[name].skiped = true
  108. end
  109. end
  110.  
  111. if arg[1] == "shop" then
  112. beta = false
  113. for i,v in pairs(betaTesters) do
  114. if v == name then
  115. beta = true
  116. end
  117. end
  118.  
  119. if beta then
  120. tfm.exec.chatMessage("<VP>→</VP> <V>[Shop]</V> <J>Olhe a janela que abriu na sua tela.</J>",name)
  121. ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
  122. ui.addTextArea(1,'<B><J><font size="13">Loja',name,310,48,175,20,nil,0x324650,nil,true)
  123. ui.addTextArea(2,'<p align="center"><R><a href="event:close">X</a>',name,466,50,16,16,0x324650,0x324650,nil,true)
  124. ui.addTextArea(3,"<B><font size='12'>",name,305,85,190,250,0x0e232b,0x0e232b,nil,true)
  125. else
  126. tfm.exec.chatMessage("<VP>→</VP> <V>[Beta Game]</V> <R>Apenas beta testers tem essa permissão e a loja está em manutenção.</R>",name)
  127. end
  128. end
  129.  
  130. if arg[1] == "p" then
  131. tfm.exec.chatMessage("<VP>→</VP> <V>[Profile]</V> <J>Olhe a janela que abriu na sua tela.</J>",name)
  132. if arg[2] then
  133. nome = arg[2]:lower():gsub('%a', string.upper, 1) -- guarda na variavel
  134. else
  135. nome = name
  136. end
  137.  
  138. if tfm.get.room.playerList[nome] then
  139. ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
  140. ui.addTextArea(1,'<B><J><font size="13">'..nome,name,310,48,175,20,nil,0x324650,nil,true)
  141. ui.addTextArea(2,'<p align="center"><R><a href="event:close">X</a>',name,466,50,16,16,0x324650,0x324650,nil,true)
  142. ui.addTextArea(3,"<B><font size='15'><J>Rato:</J></font></p><font size='12'>Rodadas jogadas: "..p[nome].rounds.."<br>Vitórias: "..p[nome].Mwins.."<br>Derrotas: "..p[nome].kills.."",name,305,85,190,120,0x0e232b,0x0e232b,nil,true)
  143. ui.addTextArea(4,"<B><font size='15'><J>Assassino:</J></font></p><font size='12'>Rodadas jogadas: "..p[nome].killer.."<br>Vitórias: "..p[nome].Swins.."<br>Derrotas: "..p[nome].killsK.."<br>Vezes puladas: "..p[nome].kSkip,name,305,220,190,120,0x0e232b,0x0e232b,nil,true)
  144. else
  145. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <R>"..nome.." não se encontra em sala ou não existe.</R>",name)
  146. end
  147. end
  148.  
  149. end
  150.  
  151. function eventPlayerLeft(name)
  152. if name == shaman and game then
  153. newMap()
  154. end
  155. end
  156.  
  157. function newMap()
  158. tfm.exec.newGame(mapas[math.random(#mapas)])
  159. end
  160.  
  161. function eventNewGame()
  162. newShaman()
  163. time_click = 2;
  164. tfm.exec.setGameTime(math.random(60,150))
  165. tfm.exec.snow(100)
  166. end
  167.  
  168. function eventPlayerDied(name)
  169. vivos=vivos-1;
  170.  
  171. if game then
  172. p[name].kills = p[name].kills+1;
  173. end
  174.  
  175. if vivos == 2 and g_time > 50000 then
  176. tfm.exec.setGameTime(51)
  177. end
  178.  
  179. if vivos == 1 and g_time > 30000 then
  180. tfm.exec.setGameTime(31)
  181. end
  182.  
  183. if vivos == 0 and game then
  184. jogadores={}
  185.  
  186. for i in pairs(tfm.get.room.playerList) do
  187. table.insert(jogadores,i)
  188. end
  189.  
  190. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> O assassino <VP>"..shaman.."</VP> é o vencedor.")
  191. p[shaman].Swins = p[shaman].Swins+1;
  192. rec = math.random(3,10)
  193. p[shaman].xp = p[shaman].xp+rec
  194. tfm.exec.chatMessage("Você recebeu "..rec.." xp por vencer.",shaman)
  195.  
  196. if p[shaman].xp >= p[shaman].mXp then
  197. p[shaman].xp = p[shaman].xp-p[shaman].mXp
  198. p[shaman].lvl = p[shaman].lxl+1;
  199. p[shaman].mXp = p[shaman].mXp*math.random(2,4)
  200. tfm.exec.chatMessage("<J>Agora "..shaman.." é nivel "..p[shaman].lvl.."</J>")
  201. end
  202. newMap()
  203. end
  204. end
  205.  
  206. function newShaman()
  207. vivos=0
  208. for i,v in pairs(tfm.get.room.playerList) do
  209. if v.isShaman then
  210. shaman = i
  211. skip = 0
  212. end
  213. vivos=vivos+1;
  214. end
  215.  
  216. if vivos > 2 then
  217. game = true
  218. for i in pairs(tfm.get.room.playerList) do
  219. if i ~= shaman then
  220. p[i].rounds = p[i].rounds+1;
  221. end
  222.  
  223. p[i].skiped = false
  224. tfm.exec.giveMeep(i)
  225. end
  226.  
  227. p[shaman].killer = p[shaman].killer+1;
  228. p[shaman].kills = p[shaman].kills-1;
  229. tfm.exec.killPlayer(shaman)
  230. tfm.exec.setPlayerScore(shaman,0,false)
  231. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N><CE>"..shaman.."</CE> é o assassino.</N>")
  232. else
  233. game = false
  234. tfm.exec.newGame(intervalMaps[math.random(#intervalMaps)])
  235. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N><R>É necessário 3 jogadores.</N>")
  236. end
  237. end
  238.  
  239. function eventMouse(name,x,y)
  240. if time_click == 0 and name == shaman and game then
  241. tfm.exec.explosion (x, y, p[name].sp, 100, true)
  242. tfm.exec.displayParticle(12,x,y)
  243. for i=1,25 do
  244. tfm.exec.displayParticle(0,x,y,math.random(-6,6),math.random(-6,6))
  245. end
  246. time_click = 2
  247. end
  248. end
  249.  
  250. function eventTextAreaCallback(id,name,link)
  251. if link=="close" then
  252. for id=0,61 do
  253. ui.removeTextArea(id,name)
  254. ui.removeTextArea(6969+id,name)
  255. ui.removeTextArea(7979+id,name)
  256. end
  257. end
  258. end
  259.  
  260. function eventLoop(t,r)
  261. g_time = r
  262. if t >= 3000 then
  263. if time_click > 0 and game then
  264. ui.addTextArea(8,'<p align="center"><B><VP>'..math.floor(time_click/2),nil,6,380,20,20,0,0,0,true)
  265. time_click = time_click-1;
  266. elseif time_click == 0 then
  267. ui.removeTextArea(8,nil)
  268. end
  269.  
  270. if vivos == 0 then
  271. newMap()
  272. vivos=1
  273. end
  274. end
  275.  
  276. if r < 1000 and game then
  277. for i,v in pairs(tfm.get.room.playerList) do
  278. if not v.isDead and game then
  279. tfm.exec.giveCheese(i)
  280. tfm.exec.playerVictory(i)
  281. p[i].Mwins = p[i].Mwins+1;
  282. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <VP>"..i.."</VP> é o vencedor.")
  283. p[shaman].killsK = p[shaman].killsK+1;
  284.  
  285. rec = math.random(3,10)
  286. p[i].xp = p[i].xp+rec
  287. tfm.exec.chatMessage("Você recebeu "..rec.." xp por vencer.",i)
  288. end
  289.  
  290. if p[i].xp >= p[i].mXp then
  291. p[i].xp = p[i].xp-p[i].mXp
  292. p[i].lvl = p[i].lxl+1;
  293. p[i].mXp = p[i].mXp*math.random(2,4)
  294. tfm.exec.chatMessage("<J>Agora "..i.." é nivel "..p[i].lvl.."</J>")
  295. p[i].sp = p[i].sp+1;
  296. end
  297. end
  298.  
  299. vivos=vivos-1;
  300.  
  301. end
  302.  
  303. if t >= 3000 and skip >= math.random(#p/2) and game then
  304. jogadores = {}
  305.  
  306. for i in pairs(tfm.get.room.playerList) do
  307. table.insert(jogadores,i)
  308. end
  309. tfm.exec.setPlayerScore(jogadores[math.random(#jogadores)],16,false)
  310. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <J>A vez do assassino <BL>"..shaman.."</BL> foi pulada.</J>")
  311. p[shaman].kSkip = p[shaman].kSkip+1;
  312. newMap()
  313. end
  314.  
  315. end
  316.  
  317. function eventRanking(name)
  318. tfm.exec.chatMessage("<VP>→</VP> <V>[Rank]</V> <J>Olhe a janela que abriu na sua tela.</J>",name)
  319. tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <R><B>Legenda do ranking:</B></R><br><BL>→</BL> VCR - Vitórias como rato.<br><BL>→</BL> DCR - Derrotas como rato.<br><BL>→</BL> VCA - Vitórias como assassino.<br><BL>→</BL> DCA - Derrotas como assassino.",name)
  320. local sc = {}
  321. ids = {}
  322. for name, player in pairs(tfm.get.room.playerList) do
  323. sc[#sc+1] = {n=name,s=player.score,r=p[name].rounds,vcr=p[name].Mwins,dcr=p[name].kills,vca=p[name].Swins,dca=p[name].killsK}
  324. end
  325. table.sort(sc,function(a,b) return a.dca>b.dca end)
  326. table.sort(sc,function(a,b) return a.vca>b.vca end)
  327. table.sort(sc,function(a,b) return a.dcr>b.dcr end)
  328. table.sort(sc,function(a,b) return a.vcr>b.vcr end)
  329. y = 20
  330. id = 50
  331.  
  332.  
  333. ui.addTextArea(0,"",name,120,45,500,340,nil,0x324650,nil,true)
  334. ui.addTextArea(1,'<p align="center"><B><J><font size="13">Ranking',name,130,48,475,20,nil,0x324650,nil,true)
  335. ui.addTextArea(2,'<p align="center"><R><a href="event:close">Fechar</a>',name,130,360,475,20,0x324650,0x324650,nil,true)
  336. str=''
  337. for k,v in pairs(sc) do
  338. if k < 9 then
  339. id = id+1;
  340. table.insert(ids, id)
  341. y = y+35
  342. str = "<N><J>"..k.."°</J> | <V>"..v.n.."</V> | Rodadas: <V>"..v.r.."</V> | VCR: <V>"..v.vcr.."</V> | DCR: <V>"..v.dcr.."</V> | VCA: <V>"..v.vca.."</V> | DCA: <V>"..v.dca.."</V></N><br>"
  343. ui.addTextArea(id,str,name,130,y+30,475,20,0x0e232b,0x0e232b,nil,true)
  344. end
  345. end
  346.  
  347. return str
  348. end
  349.  
  350.  
  351. for all in pairs(tfm.get.room.playerList) do
  352. eventNewPlayer(all)
  353. end
  354.  
  355. tfm.exec.setRoomMaxPlayers(30)
  356. newMap()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement