Advertisement
Dudugz-Contistente

Untitled

Dec 14th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.15 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,6961814,6954653}
  4. shaman = ""
  5.  
  6. data = {}
  7.  
  8. p={}
  9.  
  10. translations = {
  11. br = {
  12. name = "br",
  13. welcome = "<CE>Bem-vindo ao explosion v3.0</CE>",
  14. commands = "<B><J>Comandos:</J></B><br>!help - abre a janela de ajuda.<br>!p <V>[Nome]</V> - abre o perfil de um jogador e sem o nome abre o seu.<br>!rank - abre o ranking do jogo.",
  15. developers = "Minigame criado por <V>Contistente</V> & <V>Rianmojang</V>.",
  16. topic = "<VP>Acesse o nosso tópico do fórum:<br>http://atelier801.com/topic?f=6&t=839504&p=1</VP>",
  17. window_help = "<B><J><p align='center'><font size='15'>Centro de ajuda",
  18. text_help = "O jogo consiste em um assassino que deve matar todos os ratos clicando na tela para soltar um explosão, e para que os ratos sejam vencedores devem sobreviver até o tempo acabar.",
  19. close = "<R><B><p align='center'><font size='12'><a href='event:close'>Fechar</a>",
  20. not_room_player = " não está na sala.",
  21. tribe = "Tribo",
  22. mouse = "Rato",
  23. community = "Comunidade",
  24. rounds = "Rodadas Jogadas",
  25. wins = "Vitórias",
  26. losers = "Derrotas",
  27. killer = "Assassino",
  28. learderboard = "Ranking",
  29. winner = "é o vencedor.",
  30. not_game = "É preciso 3 jogadores para iniciar o jogo.",
  31. new_killer = "é o assassino.",
  32. legend_name = "Legenda do ranking:",
  33. legend_vcr = "Vitórias como rato.",
  34. legend_dcr = "Derrotas como rato.",
  35. legend_vca = "Vitórias como assassino.",
  36. legend_dca = "Derrotas como assasino.",
  37. },
  38.  
  39. en = {
  40. name = "en",
  41. welcome = "<CE>Welcome to explosion v3.0</CE>",
  42. commands = "<B><J>Commands:</J></B><br>!help - open the help window.<br>!p <V>[Name]</V> - open the profile of a player and with no name open your profile.<br>!rank open the ranking of the game.",
  43. developers = "Minigame created by <V>Contistente</V> & <V>Rianmojang</V>.",
  44. topic = "<VP>Acess our topic in the forum:<br>http://atelier801.com/topic?f=6&t=839504&p=1</VP>",
  45. window_help = "<B><J><p align='center'><font size='15'>Help center",
  46. text_help = "The game consists of a killer who must kill all the rats by clicking on the screen to release an explosion, and for the rats to be winners they must survive until time runs out.",
  47. close = "<R><B><p align='center'><font size='12'><a href='event:close'>Close</a>",
  48. not_room_player = " is not in the room.",
  49. tribe = "Tribe",
  50. mouse = "Mouse",
  51. community = "Community",
  52. rounds = "Rounds played",
  53. wins = "Wins",
  54. losers = "Losers",
  55. killer = "Killer",
  56. learderboard = "Learderboard",
  57. winner = "is the winner.",
  58. not_game = "It takes 3 players to start the game.",
  59. new_killer = "is the killer.",
  60. legend_name = "Ranking subtitle:",
  61. legend_vcr = "Wins as a mouse",
  62. legend_dcr = "Defeats as a mouse",
  63. legend_vca = "Wins as a killer",
  64. legend_dca = "Defeats as a killer",
  65. }
  66. }
  67.  
  68. skip = 0
  69.  
  70. time_click = 0;
  71. vivos = 0;
  72. message=false
  73. g_time = 0;
  74.  
  75. --Funções--
  76.  
  77. tfm.exec.disableAutoNewGame(true)
  78. tfm.exec.disableAutoTimeLeft(true)
  79. tfm.exec.disableAllShamanSkills(true)
  80.  
  81. function split(t,s)
  82. local a={}
  83. for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  84. table.insert(a,i)
  85. end
  86. return a
  87. end
  88.  
  89.  
  90. function eventNewPlayer(name)
  91. p[name]={
  92. rounds=0,
  93. Mwins=0,
  94. Swins=0,
  95. kills=0,
  96. killer=0,
  97. killsK=0,
  98. kSkip=0,
  99. lang = "",
  100. skiped=false,
  101. }
  102.  
  103. trans = false
  104.  
  105. for i,v in pairs(translations) do
  106. print(v.name)
  107. if v.name == tfm.get.room.playerList[name].community then
  108. trans = true
  109. p[name].lang = v.name
  110. end
  111. end
  112.  
  113. if not trans then
  114. lang = "en"
  115. end
  116.  
  117. system.bindMouse(name,true)
  118.  
  119. for i,v in pairs(data) do
  120. if v[1] == name then
  121. p[name] = v[2]
  122. end
  123. end
  124.  
  125. table.insert(data,{name, p[name]})
  126. tfm.exec.chatMessage(translations[p[name].lang].welcome,name)
  127. tfm.exec.chatMessage(translations[p[name].lang].commands,name)
  128. tfm.exec.chatMessage(translations[p[name].lang].developers,name)
  129. tfm.exec.chatMessage(translations[p[name].lang].topic,name)
  130. eventChatCommand(name,'help')
  131.  
  132.  
  133. if not game then
  134. tfm.exec.newGame(mapas[math.random(#mapas)])
  135. end
  136.  
  137.  
  138. end
  139.  
  140. function split(t,s)
  141. local a={}
  142. for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  143. table.insert(a,i)
  144. end
  145. return a
  146. end
  147.  
  148. function eventChatCommand(name, cmd)
  149. local arg = split(cmd, " ")
  150.  
  151. if arg[1] == "help" then
  152. ui.addTextArea(3,"",name,300,45,200,300,nil,0x324650,nil,true)
  153. ui.addTextArea(4,translations[p[name].lang].window_help,name,295,40,210,30,nil,0x2e424d,nil,true)
  154. ui.addTextArea(5,'<font size="11"><B>'..translations[p[name].lang].text_help,name,305,85,190,220,0x0e232b,0x0e232b,nil,true)
  155. ui.addTextArea(6,translations[p[name].lang].close,name,305,320,190,20,0x3c5063,0x3c5063,nil,true)
  156. end
  157.  
  158. if arg[1] == "p" then
  159. if arg[2] then
  160. nome = arg[2]:lower():gsub('%a', string.upper, 1) -- guarda na variavel
  161. else
  162. nome = name
  163. end
  164.  
  165. if tfm.get.room.playerList[nome] then
  166. ui.addTextArea(0,"",name,250,40,300,300,nil,0x324650,nil,true)
  167. ui.addTextArea(1,'<B><J><font size="16"><p align="center">'..nome,name,245,35,310,30,nil,0x2e424d,nil,true)
  168. ui.addTextArea(2,"<font size='12'>"..translations[p[name].lang].tribe.." : <J>"..tfm.get.room.playerList[nome].tribeName.."</J><br>"..translations[p[name].lang].community.." : <V>"..tfm.get.room.playerList[nome].community.."</V><br><br><font size='15'>"..translations[p[name].lang].mouse.."</font><br><font color='#6a7495'> • "..translations[p[name].lang].rounds.." : </font> <V>"..p[nome].rounds.."</V><br><font color='#6a7495'> • "..translations[p[name].lang].wins.." : </font> <V>"..p[nome].Mwins.."</V><br><font color='#6a7495'> • "..translations[p[name].lang].losers.." : </font> <V>"..p[nome].kills.."<br><br><font size='15'><N>"..translations[p[name].lang].killer.."</N></font><br><font color='#6a7495'> • "..translations[p[name].lang].rounds.." : </font> <V>"..p[nome].killer.."</V><br><font color='#6a7495'> • "..translations[p[name].lang].wins.." : </font> <V>"..p[nome].Swins.."</V><br><font color='#6a7495'> • "..translations[p[name].lang].losers.." : </font> <V>"..p[nome].killsK.."",name,255,80,290,220,0x0e232b,0x0e232b,nil,true)
  169. ui.addTextArea(-1,translations[p[name].lang].close,name,255,315,290,20,0x3c5063,0x3c5063,nil,true)
  170. else
  171. tfm.exec.chatMessage("<R>"..nome..""..translations[p[name].lang].not_room_player.."</R>",name)
  172. end
  173. end
  174.  
  175. if arg[1] == "rank" then
  176. eventRanking(name)
  177. end
  178. end
  179.  
  180. function eventPlayerLeft(name)
  181. if name == shaman and game then
  182. newMap()
  183. end
  184. end
  185.  
  186. function newMap()
  187. tfm.exec.newGame(mapas[math.random(#mapas)])
  188. end
  189.  
  190. function eventNewGame()
  191. newShaman()
  192. time_click = 2;
  193. tfm.exec.setGameTime(100)
  194. tfm.exec.snow(100)
  195. end
  196.  
  197. function eventPlayerDied(name)
  198. vivos=vivos-1;
  199.  
  200. if game then
  201. p[name].kills = p[name].kills+1;
  202. end
  203.  
  204. if vivos == 1 and g_time > 30000 then
  205. tfm.exec.setGameTime(31)
  206. end
  207.  
  208. if vivos == 0 and game then
  209. for i in pairs(tfm.get.room.playerList) do
  210. tfm.exec.chatMessage("<CH>"..i.."</CH> "..translations[p[i].lang].winner,i)
  211. end
  212. p[shaman].Swins = p[shaman].Swins+1;
  213. newMap()
  214. end
  215. end
  216.  
  217. function newShaman()
  218. vivos=0
  219. for i,v in pairs(tfm.get.room.playerList) do
  220. if v.isShaman then
  221. shaman = i
  222. skip = 0
  223. end
  224. vivos=vivos+1;
  225. end
  226.  
  227. if vivos > 2 then
  228. game = true
  229. for i in pairs(tfm.get.room.playerList) do
  230. if i ~= shaman then
  231. p[i].rounds = p[i].rounds+1;
  232. end
  233.  
  234. p[i].skiped = false
  235. tfm.exec.giveMeep(i)
  236. end
  237. p[shaman].killer = p[shaman].killer+1;
  238. p[shaman].kills = p[shaman].kills-1;
  239. tfm.exec.killPlayer(shaman)
  240. tfm.exec.setPlayerScore(shaman,0,false)
  241. for i in pairs(tfm.get.room.playerList) do
  242. tfm.exec.chatMessage("<VP>"..i.."</VP> "..translations[p[i].lang].new_killer,i)
  243. end
  244. else
  245. game = false
  246. for i in pairs(tfm.get.room.playerList) do
  247. tfm.exec.chatMessage("<R>"..translations[p[i].lang].not_game,i)
  248. end
  249. end
  250. end
  251.  
  252. function eventMouse(name,x,y)
  253. if time_click == 0 and name == shaman and game then
  254. tfm.exec.explosion (x, y, math.random(20,40), 100, true)
  255. tfm.exec.displayParticle(12,x,y)
  256. for i=1,25 do
  257. tfm.exec.displayParticle(0,x,y,math.random(-6,6),math.random(-6,6))
  258. end
  259. time_click = 2
  260. end
  261. end
  262.  
  263. function eventTextAreaCallback(id,name,link)
  264. if link=="close" then
  265. for id=-1,61 do
  266. ui.removeTextArea(id,name)
  267. ui.removeTextArea(6969+id,name)
  268. ui.removeTextArea(7979+id,name)
  269. end
  270. end
  271. end
  272.  
  273. function eventLoop(t,r)
  274. g_time = r
  275. if t >= 3000 then
  276. if time_click > 0 and game then
  277. ui.addTextArea(8,'<p align="center"><B><VP>'..math.floor(time_click/2),nil,6,380,20,20,0,0,0,true)
  278. time_click = time_click-1;
  279. elseif time_click == 0 then
  280. ui.removeTextArea(8,nil)
  281. end
  282.  
  283. if vivos == 0 then
  284. newMap()
  285. vivos=1
  286. end
  287. end
  288.  
  289. if r < 1000 and game then
  290. w = ''
  291.  
  292. for i,v in pairs(tfm.get.room.playerList) do
  293. if not v.isDead and game then
  294. tfm.exec.giveCheese(i)
  295. tfm.exec.playerVictory(i)
  296. p[i].Mwins = p[i].Mwins+1;
  297. w = i
  298. p[shaman].killsK = p[shaman].killsK+1;
  299. end
  300. end
  301.  
  302. if w ~= '' then
  303. for i in pairs(tfm.get.room.playerList) do
  304. tfm.exec.chatMessage("<VP>"..i.."</VP> "..translations[p[i].lang].winner,i)
  305. end
  306. end
  307.  
  308. vivos=vivos-1;
  309.  
  310. end
  311.  
  312. end
  313.  
  314. function eventRanking(name)
  315. tfm.exec.chatMessage("<R><B>"..translations[p[name].lang].legend_name.."</B></R><br>VCR - "..translations[p[name].lang].legend_vcr..".<br>DCR - "..translations[p[name].lang].dcr..".<br>VCA - "..translations[p[name].lang].vca..".<br>DCA - "..translations[p[name].lang].dca..".",name)
  316. local sc = {}
  317. ids = {}
  318. for name, player in pairs(tfm.get.room.playerList) do
  319. 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}
  320. end
  321. table.sort(sc,function(a,b) return a.dca>b.dca end)
  322. table.sort(sc,function(a,b) return a.vca>b.vca end)
  323. table.sort(sc,function(a,b) return a.dcr>b.dcr end)
  324. table.sort(sc,function(a,b) return a.vcr>b.vcr end)
  325. y = 20
  326. id = 50
  327.  
  328.  
  329. ui.addTextArea(0,"",name,120,45,500,340,nil,0x324650,nil,true)
  330. ui.addTextArea(1,'<p align="center"><B><J><font size="13">'..translations[p[name].lang].learderboard,name,130,48,475,20,nil,0x324650,nil,true)
  331. ui.addTextArea(2,translations[p[name].lang].close,name,130,360,475,20,0x3c5063,0x3c5063,nil,true)
  332. str=''
  333. for k,v in pairs(sc) do
  334. if k < 11 then
  335. id = id+1;
  336. table.insert(ids, id)
  337. y = y+35
  338. 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>"
  339. ui.addTextArea(id,str,name,130,y+30,475,20,0x0e232b,0x0e232b,nil,true)
  340. end
  341. end
  342.  
  343. return str
  344. end
  345.  
  346.  
  347. for all in pairs(tfm.get.room.playerList) do
  348. eventNewPlayer(all)
  349. end
  350.  
  351. tfm.exec.setRoomMaxPlayers(30)
  352. newMap()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement