Dudugz-Contistente

Untitled

Dec 15th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.04 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. system.bindMouse(name,true)
  104.  
  105. for i,v in pairs(data) do
  106. if v[1] == name then
  107. p[name] = v[2]
  108. end
  109. end
  110.  
  111. table.insert(data,{name, p[name]})
  112.  
  113. p[name].lang = translations[tfm.get.room.playerList[name].community] and tfm.get.room.playerList[name].community or 'en'
  114. tfm.exec.chatMessage(translations[p[name].lang].welcome,name)
  115. tfm.exec.chatMessage(translations[p[name].lang].commands,name)
  116. tfm.exec.chatMessage(translations[p[name].lang].developers,name)
  117. tfm.exec.chatMessage(translations[p[name].lang].topic,name)
  118. eventChatCommand(name,'help')
  119.  
  120.  
  121. if not game then
  122. tfm.exec.newGame(mapas[math.random(#mapas)])
  123. end
  124.  
  125.  
  126. end
  127.  
  128. function split(t,s)
  129. local a={}
  130. for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  131. table.insert(a,i)
  132. end
  133. return a
  134. end
  135.  
  136. function eventChatCommand(name, cmd)
  137. local arg = split(cmd, " ")
  138.  
  139. if arg[1] == "help" then
  140. ui.addTextArea(3,"",name,300,45,200,300,nil,0x324650,nil,true)
  141. ui.addTextArea(4,translations[p[name].lang].window_help,name,295,40,210,30,nil,0x2e424d,nil,true)
  142. ui.addTextArea(5,'<font size="11"><B>'..translations[p[name].lang].text_help,name,305,85,190,220,0x0e232b,0x0e232b,nil,true)
  143. ui.addTextArea(6,translations[p[name].lang].close,name,305,320,190,20,0x3c5063,0x3c5063,nil,true)
  144. end
  145.  
  146. if arg[1] == "p" then
  147. if arg[2] then
  148. nome = arg[2]:lower():gsub('%a', string.upper, 1) -- guarda na variavel
  149. else
  150. nome = name
  151. end
  152.  
  153. if tfm.get.room.playerList[nome] then
  154. ui.addTextArea(0,"",name,250,40,300,300,nil,0x324650,nil,true)
  155. ui.addTextArea(1,'<B><J><font size="16"><p align="center">'..nome,name,245,35,310,30,nil,0x2e424d,nil,true)
  156. 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)
  157. ui.addTextArea(-1,translations[p[name].lang].close,name,255,315,290,20,0x3c5063,0x3c5063,nil,true)
  158. else
  159. tfm.exec.chatMessage("<R>"..nome..""..translations[p[name].lang].not_room_player.."</R>",name)
  160. end
  161. end
  162.  
  163. if arg[1] == "rank" then
  164. eventRanking(name)
  165. end
  166. end
  167.  
  168. function eventPlayerLeft(name)
  169. if name == shaman and game then
  170. newMap()
  171. end
  172. end
  173.  
  174. function newMap()
  175. tfm.exec.newGame(mapas[math.random(#mapas)])
  176. end
  177.  
  178. function eventNewGame()
  179. newShaman()
  180. time_click = 2;
  181. tfm.exec.setGameTime(100)
  182. tfm.exec.snow(100)
  183. end
  184.  
  185. function eventPlayerDied(name)
  186. vivos=vivos-1;
  187.  
  188. if game then
  189. p[name].kills = p[name].kills+1;
  190. end
  191.  
  192. if vivos == 1 and g_time > 30000 then
  193. tfm.exec.setGameTime(31)
  194. end
  195.  
  196. if vivos == 0 and game then
  197. for i in pairs(tfm.get.room.playerList) do
  198. tfm.exec.chatMessage("<CH>"..shaman.."</CH> "..translations[p[i].lang].winner,i)
  199. end
  200. p[shaman].Swins = p[shaman].Swins+1;
  201. newMap()
  202. end
  203. end
  204.  
  205. function newShaman()
  206. vivos=0
  207. for i,v in pairs(tfm.get.room.playerList) do
  208. if v.isShaman then
  209. shaman = i
  210. skip = 0
  211. end
  212. vivos=vivos+1;
  213. end
  214.  
  215. if vivos > 2 then
  216. game = true
  217. for i in pairs(tfm.get.room.playerList) do
  218. if i ~= shaman then
  219. p[i].rounds = p[i].rounds+1;
  220. end
  221.  
  222. p[i].skiped = false
  223. tfm.exec.giveMeep(i)
  224. end
  225. p[shaman].killer = p[shaman].killer+1;
  226. p[shaman].kills = p[shaman].kills-1;
  227. tfm.exec.killPlayer(shaman)
  228. tfm.exec.setPlayerScore(shaman,0,false)
  229. for i in pairs(tfm.get.room.playerList) do
  230. tfm.exec.chatMessage("<VP>"..shaman.."</VP> "..translations[p[i].lang].new_killer,i)
  231. end
  232. else
  233. game = false
  234. for i in pairs(tfm.get.room.playerList) do
  235. tfm.exec.chatMessage("<R>"..translations[p[i].lang].not_game,i)
  236. end
  237. end
  238. end
  239.  
  240. function eventMouse(name,x,y)
  241. if time_click == 0 and name == shaman and game then
  242. tfm.exec.explosion (x, y, math.random(20,40), 100, true)
  243. tfm.exec.displayParticle(12,x,y)
  244. for i=1,25 do
  245. tfm.exec.displayParticle(0,x,y,math.random(-6,6),math.random(-6,6))
  246. end
  247. time_click = 2
  248. end
  249. end
  250.  
  251. function eventTextAreaCallback(id,name,link)
  252. if link=="close" then
  253. for id=-1,61 do
  254. ui.removeTextArea(id,name)
  255. ui.removeTextArea(6969+id,name)
  256. ui.removeTextArea(7979+id,name)
  257. end
  258. end
  259. end
  260.  
  261. function eventLoop(t,r)
  262. g_time = r
  263. if t >= 3000 then
  264. if time_click > 0 and game then
  265. ui.addTextArea(8,'<p align="center"><B><VP>'..math.floor(time_click/2),nil,6,380,20,20,0,0,0,true)
  266. time_click = time_click-1;
  267. elseif time_click == 0 then
  268. ui.removeTextArea(8,nil)
  269. end
  270.  
  271. if vivos == 0 then
  272. newMap()
  273. vivos=1
  274. end
  275. end
  276.  
  277. if r < 1000 and game then
  278. w = ''
  279.  
  280. for i,v in pairs(tfm.get.room.playerList) do
  281. if not v.isDead and game then
  282. tfm.exec.giveCheese(i)
  283. tfm.exec.playerVictory(i)
  284. p[i].Mwins = p[i].Mwins+1;
  285. for n in pairs(tfm.get.room.playerList) do
  286. tfm.exec.chatMessage("<VP>"..i.."</VP> "..translations[p[i].lang].winner,n)
  287. end
  288. p[shaman].killsK = p[shaman].killsK+1;
  289. end
  290. end
  291.  
  292. vivos=vivos-1;
  293.  
  294. end
  295.  
  296. end
  297.  
  298. function eventRanking(name)
  299. 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].legend_dcr..".<br>VCA - "..translations[p[name].lang].legend_vca..".<br>DCA - "..translations[p[name].lang].legend_dca..".",name)
  300. local sc = {}
  301. ids = {}
  302. for name, player in pairs(tfm.get.room.playerList) do
  303. 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}
  304. end
  305. table.sort(sc,function(a,b) return a.dca>b.dca end)
  306. table.sort(sc,function(a,b) return a.vca>b.vca end)
  307. table.sort(sc,function(a,b) return a.dcr>b.dcr end)
  308. table.sort(sc,function(a,b) return a.vcr>b.vcr end)
  309. y = 20
  310. id = 50
  311.  
  312.  
  313. ui.addTextArea(0,"",name,120,45,500,340,nil,0x324650,nil,true)
  314. 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)
  315. ui.addTextArea(2,translations[p[name].lang].close,name,130,360,475,20,0x3c5063,0x3c5063,nil,true)
  316. str=''
  317. for k,v in pairs(sc) do
  318. if k < 9 then
  319. id = id+1;
  320. table.insert(ids, id)
  321. y = y+35
  322. 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>"
  323. ui.addTextArea(id,str,name,130,y+30,475,20,0x0e232b,0x0e232b,nil,true)
  324. end
  325. end
  326.  
  327. return str
  328. end
  329.  
  330.  
  331. for all in pairs(tfm.get.room.playerList) do
  332. eventNewPlayer(all)
  333. end
  334.  
  335. tfm.exec.setRoomMaxPlayers(30)
  336. newMap()
Advertisement
Add Comment
Please, Sign In to add comment