Advertisement
Dudugz-Contistente

Untitled

Nov 27th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.54 KB | None | 0 0
  1.  
  2. mapas = {6939693,6947704,6939322,6939743,6940483,6940945,6940835,6940872,6941070,6940698,6939583,6939573,6933386,6933370,6931137,6947864,6947966,6947942,6948163}
  3. p = {}
  4.  
  5. admin = "Contistente"
  6.  
  7. shopList={
  8. {n="Multiplicador de SP",p=45,duration=10,img="158a63f99cf.png",id=5001}
  9. }
  10.  
  11. click = false
  12.  
  13. jogadores = 0
  14.  
  15. tfm.exec.disableAutoNewGame(true)
  16. tfm.exec.disableAutoShaman(true)
  17. tfm.exec.disableAutoTimeLeft(true)
  18. tfm.exec.disableAfkDeath(true)
  19.  
  20. betaTesters={"Contistente","Rianmojang","Laagaadoo","Jokibon","Batatinhawsf"}
  21.  
  22. translations={
  23. EN={
  24. help={
  25. "<b><p align='center'><J><font size='18'>How to play:</font></J><br>Rats can not die by the explosions that cause killer <R>by click on the screen</R>, just do not forget win the last alive and each mouse has meep.\n<V><p align='center'><J><font size='18'>Credits: </font></J><br><N><V>Rianmojang</V>,<CE>Contistente</CE> and <J>Laagaadoo</J>.",
  26. "<p align='center'><J><font size='18'>Commands: </font></J></p><br>!p - open the profile tab<br>!help - open the help tab<br>!rank - open the ranking tab<br>!shop - ...",
  27. "<p align='center'><J><font size='18'>Credits: </font></J><br><N><V>Rianmojang</V>,<CE>Contistente</CE> e <J>Laagaadoo</J>.",
  28. },
  29. profile={
  30. wins = "Wins: ",
  31. kills = "Kills: ",
  32. rounds = "Rounds: ",
  33. killers = "Killer: "
  34. },
  35.  
  36. rank={
  37. ["name"] = "Name",
  38. ["position"] = "Place",
  39. ["wins"] = "Wins"
  40. },
  41.  
  42. errors={
  43. ["invalid_name_1"] = "<BL>-</BL> <R>Error invalid user name,",
  44. ["invalid_name_2"] = " Is not in the room.</R>",
  45. ["manutention_shop"] = "The store is under maintenance."
  46. },
  47.  
  48. buttons = {
  49. ["help"] = "Ajuda",
  50. ["rank"] = "Ranking",
  51. ["shop"] = "Loja",
  52. },
  53.  
  54. },
  55.  
  56. BR={
  57. help={
  58. "<b><p align='center'><J><font size='18'>Como Jogar:</font></J><br>Os ratos não podem morrer para as explosões que o assasino causa <R>clickando na tela</R>, cada rato tem meep e o último vivo ganha.",
  59. "<p align='center'><J><font size='18'>Comandos: </font></J></p><br>!p - abre o perfil<br>!help - abre a aba de ajuda<br>!rank - abre o ranking<br>!loja - ...",
  60. "<p align='center'><J><font size='18'>Creditos: </font></J><br><N><V>Rianmojang</V>,<CE>Contistente</CE> e <J>Laagaadoo</J>.",
  61. },
  62. profile={
  63. ["wins"] = "Vitórias: ",
  64. ["kills"] = "Mortes: ",
  65. ["rounds"] = "Rodadas: ",
  66. ["killers"] = "Assassino: "
  67. },
  68.  
  69. rank={
  70. ["name"] = "Nome",
  71. ["position"] = "Lugar",
  72. ["wins"] = "Vitórias"
  73. },
  74.  
  75. errors={
  76. ["invalid_name_1"] = "<BL>-</BL> <R>Erro nome de usuário inválido,",
  77. ["invalid_name_2"] = " não está na sala.</R>",
  78. ["manutention_shop"] = "A loja está em manutenção."
  79. },
  80.  
  81. buttons = {
  82. ["help"] = "Ajuda",
  83. ["rank"] = "Ranking",
  84. ["shop"] = "Loja"
  85. },
  86. }
  87. }
  88.  
  89. players={}
  90.  
  91. local proximoAssassino = ''
  92.  
  93. textarea=ui.addTextArea
  94. function ui.addTextArea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss)
  95. --if not backgroundColor then backgroundColor=0x324650 end
  96. --if not borderColor then borderColor=0x000001 end
  97. if emboss then
  98. textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha)
  99. textarea(7979+id,"",targetPlayer,x,y-1,width,height,0x6A8FA2,0x6A8FA2,backgroundAlpha)
  100. end
  101. textarea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha)
  102. end
  103.  
  104. function trans(mes)
  105. if translations[tfm.get.room.community] and translations[tfm.get.room.community][mes] then
  106. return translations[tfm.get.room.community][mes]
  107. else
  108. return translations.BR[mes]
  109. end
  110. end
  111.  
  112. function grids(name,quantidade)
  113. y=100
  114. x=270
  115.  
  116. i = 0;
  117. while(i < quantidade) do
  118. i=i+1;
  119.  
  120. c = 5000+1;
  121. for i,v in pairs(shopList) do
  122. if (v.id == c) then
  123. p[name].id=tfm.exec.addImage(v.img, '&1', x-5, y-7, name)
  124. ui.addTextArea(c,"<V><a href='event:buy-"..c.."'><p align='center'>...</p></a>",name,x,y+45,35,15,nil,0x324650,nil,true)
  125. end
  126. end
  127. x=x+45;
  128.  
  129. if i == 6 then
  130. y = y+45;
  131. x=270;
  132. end
  133. end
  134.  
  135. ui.addTextArea(7000,"<p align='center'><J>"..p[name].coins,name,260,290,280,16,nil,0x324650,nil,true)
  136. end
  137.  
  138. function eventRank(name)
  139. local sc = {}
  140. for name, player in pairs(tfm.get.room.playerList) do
  141. sc[#sc+1] = {n=name,w=p[name].wins}
  142. end
  143. table.sort(sc,function(a,b) return a.w>b.w end)
  144.  
  145. y = 25
  146.  
  147. for k,v in pairs(sc) do
  148. if k < 9 then
  149. y=y+30;
  150. ui.addTextArea(9000+k,"<J>"..k.."</J> | <V>"..v.n.."</V> | <CE>"..v.w.."</CE>",name,260,y+30,280,15,nil,0x324650,nil,true)
  151. end
  152. end
  153.  
  154. end
  155.  
  156. function eventPopupAnswer(id, name, resposta)
  157. if resposta == "yes" then
  158. if p[name].coins >= id then
  159. ui.addPopup(0, 3, "O item foi comprado com sucesso.", name, 260, 150, 280, true)
  160. p[name].coins = p[name].coins-id;
  161. else
  162. ui.addPopup(0, 3, "O item não foi comprado, moedas insuficientes.", name, 260, 150, 280, true)
  163. end
  164. end
  165. end
  166.  
  167. function eventChatCommand(name,command)
  168. local arg = {}
  169.  
  170. for args in command:gmatch("[^%s]+") do
  171. table.insert(arg, args:lower())
  172. end
  173. if arg[1]=="help" then
  174. eventTextAreaCallback(0,name,'close')
  175. ui.addTextArea(1,"<font size='12'>"..trans("help")[players[name].helpid],name,250,50,300,300,nil,0x324650,nil,true)
  176. ui.addTextArea(2,"<p align='center'><a href='event:previous'><b>&lt;</b></a></p>",name,445,365,16,16,nil,0x324650,nil,true)
  177. ui.addTextArea(3,"<p align='center'><a href='event:next'><b>&gt;</b></a></p>",name,532,365,16,16,nil,0x324650,nil,true)
  178. ui.addTextArea(4,"<p align='center'><a href='event:close'><b>Fechar</b></a></p>",name,275,325,250,16,nil,0x324650,nil,true)
  179. ui.addTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name,475,365,42,16,nil,0x324650,nil,true)
  180. end
  181.  
  182. if arg[1]=="rank" then
  183. eventTextAreaCallback(0,name,'close')
  184. ui.addTextArea(1,"<p align='center'><J><font size='18'>Mini-Rank</font></J></p>",name,250,50,300,300,nil,0x324650,nil,true)
  185. ui.addTextArea(2,"<p align='center'><a href='event:close'><b>Fechar</b></a></p>",name,275,325,250,16,nil,0x324650,nil,true)
  186. for i,v in pairs({3,4,5}) do
  187. ui.removeTextArea(v,name)
  188. ui.removeTextArea(6969+v,name)
  189. ui.removeTextArea(7979+v,name)
  190. end
  191.  
  192. eventRank(name);
  193. end
  194.  
  195. if (arg[1]=="shop" or arg[1]=="loja") then
  196. eventTextAreaCallback(0,name,'close')
  197. ui.addTextArea(1,"<p align='center'><J><font size='18'>Loja</font></J></p>",name,250,50,300,300,nil,0x324650,nil,true)
  198. ui.addTextArea(2,"<p align='center'><a href='event:close'><b>Fechar</b></a></p>",name,275,325,250,16,nil,0x324650,nil,true)
  199. grids(name,#shopList);
  200. end
  201.  
  202. if arg[1]=="p" then
  203. if arg[2] then
  204. nome = arg[2]:sub(1,1):upper() .. arg[2]:sub(2):lower()
  205. else
  206. nome = name
  207. end
  208.  
  209. if tfm.get.room.playerList[nome] then
  210. eventTextAreaCallback(0,name,'close')
  211. wins = trans("profile")["wins"]
  212. kills = trans("profile")["kills"]
  213. rounds = trans("profile")["rounds"]
  214. killers = trans("profile")["killers"]
  215.  
  216. ui.addTextArea(1,"<p align='center'><b><font size='18'><J>"..nome.."</J></font><br><font size='15'><N>"..wins.."</N><V>"..p[nome].wins.."</V><br>"..kills.."</N><V>"..p[nome].kills.."</V><br>"..rounds.."</N><V>"..p[nome].rounds.."</V><br>"..killers.."</N><V>"..p[nome].killers.."</V><br>",name,250,50,300,300,nil,0x324650,nil,true)
  217. ui.addTextArea(2,"<p align='center'><a href='event:close'><b>Fechar</b></a></p>",name,275,325,250,16,nil,0x324650,nil,true)
  218. for i,v in pairs({3,4,5}) do
  219. ui.removeTextArea(v,name)
  220. ui.removeTextArea(6969+v,name)
  221. ui.removeTextArea(7979+v,name)
  222. end
  223.  
  224. else
  225. tfm.exec.chatMessage(trans("errors")["invalid_name_1"]..nome..trans("errors")["invalid_name_2"],name)
  226. end
  227. end
  228. end
  229.  
  230. function eventTextAreaCallback(id,name,callback)
  231. if callback=="help" then
  232. eventChatCommand(name,callback)
  233. elseif callback=="rank" then
  234. eventChatCommand(name,callback)
  235. elseif callback=="shop" then
  236. eventChatCommand(name,callback)
  237. elseif callback=="menu" then
  238. ui.addTextArea(800,"",name,6,365,300,25,0x1c3b40,0x1c3b40,nil,true)
  239. ui.addTextArea(801,"<p align='center'><b><a href='event:menu-close'>...</a></p>",name,6,365,20,25,0x1b393d,0x1b393d,nil,true)
  240. ui.addTextArea(802,"<p align='center'><a href='event:help'><b>"..trans("buttons")["help"].."</a></p>",name,40,368,75,20,nil,0x324650,nil,true)
  241. ui.addTextArea(803,"<p align='center'><a href='event:rank'><b>"..trans("buttons")["rank"].."</a></p>",name,130,368,75,20,nil,0x324650,nil,true)
  242. ui.addTextArea(804,"<p align='center'><a href='event:shop'><b>"..trans("buttons")["shop"].."</a></p>",name,220,368,75,20,nil,0x324650,nil,true)
  243. elseif callback=="menu-close" then
  244. for id=800,804 do
  245. ui.removeTextArea(id,name)
  246. ui.removeTextArea(6969+id,name)
  247. ui.removeTextArea(7979+id,name)
  248. end
  249.  
  250. ui.addTextArea(800,"<p align='center'><a href='event:menu'><b>...</a></p>",name,6,365,20,25,nil,0x324650,nil,true)
  251. elseif callback=="close" then
  252. players[name].helpid=1
  253. for id=1,9 do
  254. ui.removeTextArea(id,name)
  255. ui.removeTextArea(9000+id,name)
  256. ui.removeTextArea(6969+9000+id,name)
  257. ui.removeTextArea(7979+9000+id,name)
  258. ui.removeTextArea(6969+id,name)
  259. ui.removeTextArea(7979+id,name)
  260. end
  261.  
  262. tfm.exec.removeImage(p[name].id)
  263. i=0;
  264. while(i < #shopList) do
  265. i = i+1;
  266. ui.removeTextArea(5000+i,name)
  267. ui.removeTextArea(6969+5000+i,name)
  268. ui.removeTextArea(7979+5000+i,name)
  269. ui.removeTextArea(3000+i,name)
  270. ui.removeTextArea(6969+3000+i,name)
  271. ui.removeTextArea(7979+3000+i,name)
  272. ui.removeTextArea(7000,name)
  273. ui.removeTextArea(6969+7000,name)
  274. ui.removeTextArea(7979+7000,name)
  275. end
  276.  
  277. elseif callback=="next" and players[name].helpid<#trans("help") then
  278. players[name].helpid=(players[name].helpid)+1
  279. ui.updateTextArea(1,trans("help")[players[name].helpid],name)
  280. ui.updateTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name)
  281. ui.addTextArea(4,"<p align='center'><a href='event:close'><b>Fechar</b></a></p>",name,275,325,250,16,nil,0x324650,nil,true)
  282. elseif callback=="previous" and players[name].helpid>1 then
  283. players[name].helpid=players[name].helpid-1
  284. ui.updateTextArea(1,trans("help")[players[name].helpid],name)
  285. ui.updateTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name)
  286. ui.addTextArea(4,"<p align='center'><a href='event:close'><b>Fechar</b></a></p>",name,275,325,250,16,nil,0x324650,nil,true)
  287. end
  288.  
  289. for i,v in pairs(shopList) do
  290. if callback == "buy-"..v.id then
  291. ui.addPopup(v.p, 1, "<p align='center'>"..v.n.."<br>Preço: "..v.p.."<br>Duração de efeito: "..v.duration.."s<br>Você deseja comprar?", name, 260, 150, 280, true)
  292. end
  293. end
  294. end
  295.  
  296. function eventNewPlayer(name)
  297. p[name]={
  298. click = true,
  299. time_click = 0,
  300. wins = 0,
  301. kills = 0,
  302. rounds = 0,
  303. killers = 0,
  304. coins = 0,
  305. id = 0,
  306. }
  307.  
  308. if jogadores == 2 then
  309. tfm.exec.newGame(mapas[math.random(#mapas)])
  310. end
  311.  
  312. jogadores = jogadores+1;
  313. tfm.exec.setPlayerScore(name,0,false)
  314. system.bindMouse(name,true)
  315.  
  316. players[name]={helpid=1}
  317. ui.addTextArea(800,"<p align='center'><a href='event:menu'><b>...</a></p>",name,11,365,20,25,nil,0x324650,nil,true)
  318. for i,v in pairs(betaTesters) do
  319. if v == name then
  320. ui.addTextArea(31,"",name,650,365,30,25,0xBEBEBE,0xBEBEBE,nil,true)
  321. ui.addTextArea(32,"",name,700,365,30,25,0xBEBEBE,0xBEBEBE,nil,true)
  322. ui.addTextArea(33,"",name,750,365,30,25,0xBEBEBE,0xBEBEBE,nil,true)
  323. ui.addTextArea(34,"<font color='#000'>¹",name,650,360,10,16,0,0,70,true)
  324. ui.addTextArea(35,"<font color='#000'>²",name,700,360,10,16,0,0,70,true)
  325. ui.addTextArea(36,"<font color='#000'>³",name,750,360,10,16,0,0,70,true)
  326. for id=34,36 do
  327. ui.removeTextArea(6969+id,name)
  328. ui.removeTextArea(7979+id,name)
  329. end
  330. end
  331. end
  332.  
  333. if proximoAssassino ~= '' then
  334. tfm.exec.setUIMapName("<b>#explosion</b> <font color='#6a7495'>|</font> <N>Assassino: </N><V>"..proximoAssassino.."</V>")
  335. end
  336.  
  337. tfm.exec.chatMessage("<CE>"..name.." bem-vindo ao explosion.</CE><br><VP>Acesse o nosso tópico no forum: http://atelier801.com/topic?f=6&t=838331</VP>",name)
  338. end
  339.  
  340. for all in pairs(tfm.get.room.playerList) do
  341. eventNewPlayer(all)
  342. end
  343.  
  344. function eventMouse(name,x,y)
  345. if p[name].click and admin == name and jogadores >= 3 and click then
  346. tfm.exec.explosion (x, y, 20, 100, true)
  347. tfm.exec.displayParticle(12,x,y)
  348. p[name].click = false
  349. p[name].time_click = 2
  350. end
  351. end
  352.  
  353. function eventLoop(elapsed, remaining)
  354. if elapsed >= 3800 and not click then
  355. click = true
  356. end
  357.  
  358. if jogadores >= 3 then
  359. if not p[admin].click then
  360. if p[admin].time_click > 0 then
  361. ui.addTextArea(30,'<b><p align="center">'..math.floor(p[admin].time_click/2),nil,6,25,16,16,nil,0x324650,nil,80,true)
  362. p[admin].time_click = p[admin].time_click-1;
  363. else
  364. p[admin].click = true
  365. ui.removeTextArea(30,nil)
  366. ui.removeTextArea(6969+30,nil)
  367. ui.removeTextArea(7979+30,nil)
  368. end
  369. end
  370.  
  371. if remaining < 1000 then
  372. tfm.exec.newGame(mapas[math.random(#mapas)])
  373. proximoAssassino = ''
  374. end
  375. else
  376. tfm.exec.setUIMapName("<R>É necessário 3 jogadores.</R>")
  377. end
  378. end
  379.  
  380. function eventPlayerDied(name)
  381. if vivos > 2 then
  382. vivos = vivos-1;
  383. else
  384. proximoAssassino = name
  385. for i in pairs(tfm.get.room.playerList) do
  386. if not tfm.get.room.playerList[i].isDead then
  387. tfm.exec.giveCheese(i)
  388. tfm.exec.playerVictory(i)
  389. end
  390. end
  391.  
  392. tfm.exec.newGame(mapas[math.random(#mapas)])
  393. end
  394.  
  395. p[name].kills = p[name].kills+1;
  396. end
  397.  
  398. function eventPlayerWon(name)
  399. p[name].wins = p[name].wins+1;
  400. end
  401.  
  402. function eventPlayerLeft(name)
  403. jogadores = jogadores-1;
  404. end
  405.  
  406. function eventNewGame()
  407. vivos = 0
  408.  
  409. click = false
  410.  
  411. ui.removeTextArea(-1,nil)
  412. ui.removeTextArea(-2,nil)
  413.  
  414. tfm.exec.setGameTime(200)
  415.  
  416. p[admin].click = true
  417. ui.removeTextArea(30,nil)
  418. ui.removeTextArea(6969+30,nil)
  419. ui.removeTextArea(7979+30,nil)
  420.  
  421. local sc = {}
  422. for name,player in pairs(tfm.get.room.playerList) do
  423. vivos=vivos+1;
  424. sc[#sc+1] = name
  425. tfm.exec.giveMeep(name)
  426. p[name].rounds = p[name].rounds+1;
  427. eventTextAreaCallback(0,name,'close')
  428. end
  429.  
  430. if proximoAssassino == '' then
  431. proximoAssassino = sc[math.random(#sc)]
  432. end
  433.  
  434. admin = proximoAssassino
  435. tfm.exec.killPlayer(admin)
  436. p[admin].killers = p[admin].killers+1;
  437.  
  438. tfm.exec.setUIMapName("<b>#explosion</b> <font color='#6a7495'>|</font> <N>Assassino: </N><V>"..proximoAssassino.."</V>")
  439. tfm.exec.chatMessage("Cuidado <V>"..admin.."</V> é o assassino.")
  440. end
  441.  
  442. for i,v in pairs({"p","help","rank","shop","loja"}) do
  443. system.disableChatCommandDisplay(v, true)
  444. end
  445.  
  446.  
  447. tfm.exec.newGame(mapas[math.random(#mapas)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement