Advertisement
Dudugz-Contistente

Untitled

Jan 28th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.00 KB | None | 0 0
  1. --~=V.2.0!
  2.  
  3. tfm.exec.disableAutoShaman(true)
  4. tfm.exec.disableAutoNewGame(true)
  5. tfm.exec.disableAutoTimeLeft(true)
  6.  
  7. tfm.exec.disableAutoScore(true)
  8.  
  9. p={}
  10. mapas={6974651,6980764,7025719,7027009,7026887,7027767,7027747,7028052,7028067,7027140,7027083,7028660}
  11. registroSpawnObjetos = {};
  12.  
  13. pos = 0
  14.  
  15. admins = {"Hugotitas","Contistente","Shiobausamak","Trofooop","Lynezx","[Anti-Souris]"}
  16. banidos = {}
  17. data={}
  18.  
  19. moving = true
  20. tempo = os.time();
  21. stop = 0
  22. vivos=0;
  23. teclasProibidas = {[37] = true, [38] = true, [39] = true, [40] = true, [119] = true, [87] = true};
  24.  
  25. function eventNewGame()
  26. tempo = os.time();
  27. moving = true
  28. pos = 4
  29. tfm.exec.setGameTime(120)
  30.  
  31.  
  32. vivos = 0;
  33. pos=0
  34.  
  35. for i,v in pairs(tfm.get.room.playerList) do
  36. vivos=vivos+1;
  37. p[i].rodadas = p[i].rodadas + 1
  38. p[i].timestamp = os.time();
  39. ui.removeTextArea(-60,i)
  40. end
  41. end
  42.  
  43. function eventPlayerDied(name)
  44. vivos=vivos-1;
  45.  
  46. if vivos == 0 then
  47. tfm.exec.newGame(mapas[math.random(#mapas)])
  48. end
  49. end
  50.  
  51. function eventNewPlayer(name)
  52. if name:sub(1,1) ~= "*" then
  53. p[name]={
  54. money = 0,
  55. wins = 0,
  56. rodadas = 0,
  57. firsts= 0,
  58. sendMessage = true,
  59. sendTime = 0,
  60. inventory = {},
  61. using = {},
  62. shop = {
  63. {item="Caixa",price=50,id=2,buyed=false},
  64. {item="Bigorna",price=73,id=10,buyed=false},
  65. {item="Caixa Coração",price=80,id=61,buyed=false},
  66. {item="Rato Congelado",price=178,id=54,buyed=false},
  67. {item="Rocha",price=263,id=85,buyed=false},
  68. {item="R.I.P",price=300,id=90,buyed=false}
  69. },
  70. timestamp=os.time()
  71. }
  72.  
  73. for i,v in pairs(data) do
  74. if v[1] == name then
  75. p[name] = v[2]
  76. end
  77. end
  78.  
  79. table.insert(data,{name, p[name]})
  80.  
  81. for key in pairs(teclasProibidas) do --lyne
  82. system.bindKeyboard(name, key, true, true)
  83. end
  84.  
  85. system.bindKeyboard(name, 32, true, true)
  86.  
  87. tfm.exec.chatMessage("<VP>[+]</VP> <J>Bem-vindo ao <B>Stopped</B>.</J>",name)
  88. eventChatCommand(name,"help")
  89.  
  90. tfm.exec.setPlayerScore(name,0,false)
  91. else
  92. tfm.exec.chatMessage("Por favor crie uma conta para poder jogar stopped.",name)
  93. table.insert(banidos,name)
  94. tfm.exec.chatMessage("<B><V>"..name.."</V></B> foi banido do minigame.")
  95. end
  96. end
  97.  
  98.  
  99. function eventRanking(name)
  100. local sc = {}
  101.  
  102. ui.addTextArea(0,"",name,80,40,600,350,nil,0x324650,nil,true)
  103. ui.addTextArea(1,'<B><J><font size="13"><p align="center">Ranking',name,75,35,610,30,nil,0x2e424d,nil,true)
  104. ui.addTextArea(2,"Pos.",name,82,77,50,20,0x0e232b,0x0e232b,nil,true)
  105. ui.addTextArea(3,"Nome",name,146,77,120,20,0x0e232b,0x0e232b,nil,true)
  106. ui.addTextArea(4,"Firsts",name,280,77,100,20,0x0e232b,0x0e232b,nil,true)
  107. ui.addTextArea(5,"Rodadas",name,395,77,70,20,0x0e232b,0x0e232b,nil,true)
  108. ui.addTextArea(6,"Moedas",name,480,77,70,20,0x0e232b,0x0e232b,nil,true)
  109. for name, player in pairs(tfm.get.room.playerList) do
  110. this = p[name]
  111. sc[#sc+1] = {n=name,r=this.rodadas,w=this.wins,f=this.firsts,m=this.money,id=tfm.get.room.playerList[name].id} -- insira o valor que quiser
  112. end
  113.  
  114. idlist = {}
  115. table.sort(sc,function(a,b) return a.f>b.f end)
  116. table.sort(sc,function(a,b) return a.w>b.w end)
  117. table.sort(sc,function(a,b) return a.r>b.r end)
  118. table.sort(sc,function(a,b) return a.m>b.m end)
  119.  
  120. y=80
  121. for k,v in pairs(sc) do
  122. if k < 9 then
  123. y=y+32
  124. ui.addTextArea(5959+v.id,k,name,82,y,50,20,0x0e232b,0x0e232b,nil,true)
  125. ui.addTextArea(4949+v.id,v.n,name,146,y,120,20,0x0e232b,0x0e232b,nil,true)
  126. ui.addTextArea(3939+v.id,v.f,name,280,y,100,20,0x0e232b,0x0e232b,nil,true)
  127. ui.addTextArea(2929+v.id,v.r,name,395,y,70,20,0x0e232b,0x0e232b,nil,true)
  128. ui.addTextArea(1919+v.id,v.m,name,480,y,70,20,0x0e232b,0x0e232b,nil,true)
  129.  
  130. for i,id in pairs({5959,4949,3939,2929,1919}) do
  131. table.insert(idlist,id+v.id)
  132. end
  133. end
  134. end
  135.  
  136.  
  137.  
  138. -- ui.addTextArea(2,"<B><font size='12'>"..str,name,305,85,190,220,0x0e232b,0x0e232b,nil,true)
  139. ui.addTextArea(-1,"<B><p align='center'><font size='15'><R><a href='event:close'>Fechar</a>",name,82,368,596,20,0x3c5063,0x3c5063,nil,true)
  140. return str
  141. end
  142.  
  143. function isAdmin(name)
  144. str = false
  145. for i,v in pairs(admins) do
  146. if v == name then
  147. str = true
  148. end
  149. end
  150.  
  151. return str
  152. end
  153.  
  154. function split(t,s)
  155. local a={}
  156. for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  157. table.insert(a,i)
  158. end
  159. return a
  160. end
  161.  
  162. function eventChatCommand(name,cmd)
  163. local arg = split(cmd, " ")
  164.  
  165. this = p[name]
  166. if arg[1] == "ban" and arg[2] and isAdmin(name) then
  167. nome = arg[2]:lower():gsub('%a', string.upper, 1)
  168.  
  169. if tfm.get.room.playerList[nome] then
  170. table.insert(banidos,nome)
  171. tfm.exec.chatMessage("<VP>[+]</VP> <N>Você baniu "..nome..".</N>",name)
  172.  
  173. for i,v in pairs(admins) do
  174. tfm.exec.chatMessage("<VP>[+]</VP> <N><B><V>"..name.."</V> baniu <J>"..nome.."</J></B>",v)
  175. end
  176. end
  177. end
  178.  
  179. if arg[1] == "mod" then
  180. onlines = ""
  181. offlines = ""
  182.  
  183. for i,v in pairs(admins) do
  184. if tfm.get.room.playerList[v] then
  185. if onlines ~= "" then
  186. onlines = onlines..","..v
  187. else
  188. onlines = v
  189. end
  190. else
  191. if offlines ~= "" then
  192. offlines = offlines..","..v
  193. else
  194. offlines = v
  195. end
  196. end
  197. end
  198.  
  199. if onlines == "" then
  200. text = "Nenhum administrador em sala.<br>Administradores fora da sala: "..offlines
  201. elseif offlines == "" then
  202. text = "Administradores em sala: "..onlines.."<br>Nenhum administrador fora da sala."
  203. else
  204. text = "Administradores em sala: "..onlines.."<br>Administradores fora da sala: "..offlines
  205. end
  206.  
  207. tfm.exec.chatMessage(text,name)
  208. end
  209.  
  210. if arg[1] == "unban" and arg[2] and isAdmin(name) then
  211. nome = arg[2]:lower():gsub('%a', string.upper, 1)
  212. id = nil
  213. for i,v in pairs(banidos) do
  214. if v == nome then
  215. id = i
  216. end
  217. end
  218.  
  219. if id ~= nil then
  220. table.remove(banidos,id)
  221. ui.removeTextArea(-60,name)
  222. tfm.exec.chatMessage("<VP>[+]</VP> <N>Você desbaniu "..nome..".</N>",name)
  223. for i,v in pairs(admins) do
  224. tfm.exec.chatMessage("<VP>[+]</VP> <N><B><V>"..name.."</V></B> desbaniu <B><J>"..nome.."</J></B>.</N>",v)
  225. end
  226. end
  227. end
  228.  
  229. if arg[1] == "rank" then
  230. eventRanking(name)
  231. end
  232.  
  233. if arg[1] == "help" then
  234. tfm.exec.chatMessage("<VP>Olá, pegue o queijo para vencer, temos ranking,loja inventário, veja utilizando os comandos: <B>!rank</B>,<B>!shop</B>,<B>!inv</B>, veja suas moedas com <B>!money</B> e tome muito cuidado preste atenção no semáforo para não morrer.</VP>",name)
  235. end
  236.  
  237. if arg[1] == "p" then
  238. if arg[2] then
  239. nome = arg[2]:lower():gsub('%a', string.upper, 1)
  240. else
  241. nome = name
  242. end
  243.  
  244. if tfm.get.room.playerList[nome] then
  245. this = tfm.get.room.playerList[nome]
  246. client = p[nome]
  247. ui.addTextArea(0,"",name,250,40,300,300,nil,0x324650,nil,true)
  248. ui.addTextArea(1,'<B><J><font size="17"><p align="center">'..nome,name,245,35,310,30,nil,0x2e424d,nil,true)
  249. ui.addTextArea(2,"Comunidade: <J>"..this.community:lower():gsub('%a', string.upper, 1).."</J><br>Look: <V>"..this.look.."</V><br><br><B>Rato</B><br><BL> • Queijos coletados em primeiro: <V>"..client.firsts.."</V></BL><br><BL> • Queijos coletados: <V>"..client.wins.."</V></BL><br><BL> • Moedas: <V>"..client.money.."</V></BL><br><BL> • Rodadas jogadas: <V>"..client.rodadas.."</V></BL>",name,255,80,290,220,0x0e232b,0x0e232b,nil,true)
  250. ui.addTextArea(3,"<R><p align='center'><B><a href='event:close'>Fechar</a>",name,255,315,290,20,0x3c5063,0x3c5063,nil,true)
  251. else
  252. tfm.exec.chatMessage("<R>"..nome.." não se encontra em sala.</R>",name)
  253. end
  254. end
  255.  
  256. if arg[1] == "money" then
  257. sendMessage(name,"<B><VP>Você tem <I>"..p[name].money.."</I> moedas.</VP></B>",name)
  258. end
  259.  
  260. if arg[1] == "shop" then
  261. eventShop(name)
  262. end
  263.  
  264. if arg[1] == "inv" then
  265. eventInv(name)
  266. end
  267. end
  268.  
  269. function eventPlayerWon(name)
  270. pos=pos+1
  271. p[name].wins = p[name].wins + 1
  272. if pos == 1 then
  273. p[name].firsts = p[name].firsts + 1
  274. end
  275.  
  276. if pos < 4 then
  277. n=name
  278.  
  279. if pos == 1 then
  280. m = 3
  281. elseif pos == 2 then
  282. m = 2
  283. elseif pos == 3 then
  284. m = 1
  285. end
  286.  
  287. Money = math.random(3,math.floor(m*4))
  288. p[n].money = p[n].money+Money
  289.  
  290. tfm.exec.playerVictory(n)
  291. tfm.exec.chatMessage("Parabéns "..n.." pegou o queijo em "..pos.."° lugar e ganhou +"..Money.." moedas.")
  292. tfm.exec.setPlayerScore(name, m, true);
  293. end
  294. vivos=vivos-1;
  295.  
  296. if vivos == 0 then
  297. tfm.exec.newGame(mapas[math.random(#mapas)])
  298. end
  299. end
  300.  
  301. function isTribeHouse()
  302. return tfm.get.room.name:sub(1,2) == string.char(42, 0x03)
  303. end
  304.  
  305. function sendMessage(name,msg)
  306. if name == nil then
  307. tfm.exec.chatMessage(msg)
  308. else
  309. tfm.exec.chatMessage(msg,name)
  310. end
  311. end
  312. function eventShop(name)
  313. y=55
  314.  
  315. ui.addTextArea(0,"",name,200,45,300,300,nil,0x324650,nil,true)
  316. ui.addTextArea(3,'<B><J><font size="13"><p align="center">Loja',name,195,40,310,30,nil,0x2e424d,nil,true)
  317. ui.addTextArea(-5,"<B><p align='center'><font size='15'><R><a href='event:close'>Fechar</a>",name,205,320,290,20,0x3c5063,0x3c5063,nil,true)
  318. for i,loja in pairs(p[name].shop) do
  319. y=y+32
  320. if loja.buyed then
  321. ui.addTextArea(2929+i,"<VP><I>"..loja.item.."</I></VP>",name,207,y,285,20,0x0e232b,0x0e232b,nil,true)
  322. else
  323. ui.addTextArea(2929+i,"<ROSE><B><a href='event:buy-"..loja.item.."'>"..loja.item.."</a></B></ROSE>",name,207,y,285,20,0x0e232b,0x0e232b,nil,true)
  324. end
  325. end
  326. end
  327.  
  328. function eventInv(name)
  329. y=55
  330.  
  331. ui.addTextArea(0,"",name,200,45,300,300,nil,0x324650,nil,true)
  332. ui.addTextArea(3,'<B><J><font size="13"><p align="center">Inventário',name,195,40,310,30,nil,0x2e424d,nil,true)
  333. ui.addTextArea(-5,"<B><p align='center'><font size='15'><R><a href='event:close'>Fechar</a>",name,205,320,290,20,0x3c5063,0x3c5063,nil,true)
  334.  
  335. for i,v in pairs(p[name].inventory) do
  336. y = y+32;
  337. if p[name].using.item == v.item then
  338. ui.addTextArea(2929+i,"<VP><I>"..v.item.."</I></VP>",name,207,y,285,20,0x0e232b,0x0e232b,nil,true)
  339. else
  340. ui.addTextArea(2929+i,"<ROSE><B><a href='event:usar-"..v.item.."'>"..v.item.."</a></B></ROSE>",name,207,y,285,20,0x0e232b,0x0e232b,nil,true)
  341. end
  342. end
  343. end
  344.  
  345. function eventTextAreaCallback(id,name,link)
  346. if link == "close" then
  347. for id=-5,6 do
  348. ui.removeTextArea(id,name)
  349. ui.removeTextArea(6969+id,name)
  350. ui.removeTextArea(7979+id,name)
  351. end
  352.  
  353. for i,v in pairs(idlist) do
  354. ui.removeTextArea(v,name)
  355. end
  356.  
  357. for i,v in pairs(p[name].shop) do
  358. ui.removeTextArea(2929+i,name)
  359. end
  360. end
  361.  
  362. for i,v in pairs(p[name].shop) do
  363. if link == "buy-"..v.item then
  364. if p[name].money >= v.price then
  365. sendMessage(nil,"<VP>[+]</VP> <V><B>"..name.."</B></V> <N>comprou o item "..v.item..".</N>")
  366. p[name].money = p[name].money-v.price
  367. table.insert(p[name].inventory,{item=v.item,id=v.id})
  368. v.buyed = true
  369. else
  370. faltando = v.price-p[name].money
  371. sendMessage(name,"<I>Você precisa de <B>+"..faltando.."</B> moedas para poder comprar este item.</I>")
  372. end
  373. eventShop(name)
  374. end
  375. end
  376.  
  377. for i,v in pairs(p[name].inventory) do
  378. if link=="usar-"..v.item then
  379. p[name].using = {item=v.item,id=v.id}
  380. eventInv(name)
  381. sendMessage(name,"<B><J>Você agora está usando o item "..v.item..".</J></B>")
  382. end
  383. end
  384. end
  385.  
  386. for all in pairs(tfm.get.room.playerList) do
  387. eventNewPlayer(all)
  388. end
  389.  
  390. function eventPlayerGetCheese(n)
  391. tfm.exec.playerVictory(n)
  392. end
  393.  
  394. function eventLoop(t,r)
  395. local agora = os.time();
  396. local remover = {};
  397.  
  398. if r < 1000 then
  399. tfm.exec.newGame(mapas[math.random(#mapas)])
  400. end
  401.  
  402. for i,v in pairs(tfm.get.room.playerList) do
  403. if v.movingRight and not moving then
  404. tfm.exec.killPlayer(i)
  405. elseif v.movingLeft and not moving then
  406. tfm.exec.killPlayer(i)
  407. end
  408. end
  409.  
  410. for i,v in pairs(banidos) do
  411. ui.addTextArea(-60,"",v,-300,-200,9999,9999,0x1C1C1C,0x1C1C1C,nil,true)
  412. tfm.exec.chatMessage("<VP>[+]</VP> <R><I>Você foi banido por um administrador da sala.</I></R>",v)
  413. tfm.exec.killPlayer(v)
  414. end
  415.  
  416. for k, item in pairs(tfm.get.room.objectList) do
  417. if (registroSpawnObjetos[item.id]) then
  418. if (agora >= registroSpawnObjetos[item.id]) then
  419. table.insert(remover, item.id);
  420. end
  421. else
  422. local duracaoObjetos = {
  423. [2] = 5000, --[Caixa grande] = 4s
  424.  
  425. [10] = 8000, --[bigorna] = 5s
  426.  
  427. [61] = 7000, --[Caixa Coração] = 10s
  428. [54] = 7000, --[Caixa Coração] = 13s
  429. [90] = 5000,
  430. [85] = 3500
  431. }
  432. local duracaoPadrao = 3000; --quanto tempo os demais objetos que não estão listados acima irão durar
  433. --formato: [id do objeto] = tempo em milisegundos
  434. --ids dos objetos: http://atelier801.com/topic?f=6&t=801563&p=1#tab_4_message_1
  435. registroSpawnObjetos[item.id] = agora + (duracaoObjetos[item.id] or duracaoPadrao);
  436. end
  437. end
  438.  
  439. for i = 1, #remover do
  440. --remoção dos objetos
  441. tfm.exec.removeObject(remover[i]);
  442. registroSpawnObjetos[remover[i]] = nil;
  443. end
  444.  
  445.  
  446. if t >= 3000 then
  447. ui.addTextArea(9,"",nil,6,30,40,85,0x1C1C1C,0x1C1C1C,nil,true)
  448. if tempo < os.time()-10000 then
  449. ui.addTextArea(10,"",nil,10,32,30,20,0x008B00,0x1C1C1C,nil,true)
  450. ui.addTextArea(11,"",nil,10,62,30,20,0xB18E00,0x1C1C1C,nil,true)
  451. ui.addTextArea(12,"",nil,10,92,30,20,0xFF0000,0x1C1C1C,nil,true)
  452. moving = false
  453.  
  454. stop = stop+1;
  455.  
  456. if stop == 8 then
  457. stop = 0
  458. tempo = os.time();
  459. end
  460. elseif tempo < os.time()-8000 then
  461. ui.addTextArea(10,"",nil,10,32,30,20,0x008B00,0x1C1C1C,nil,true)
  462. ui.addTextArea(11,"",nil,10,62,30,20,0xFFCC00,0x1C1C1C,nil,true)
  463. ui.addTextArea(12,"",nil,10,92,30,20,0xCD0000,0x1C1C1C,nil,true)
  464. else
  465. moving = true
  466. ui.addTextArea(10,"",nil,10,32,30,20,0x00FF00,0x1C1C1C,nil,true)
  467. ui.addTextArea(11,"",nil,10,62,30,20,0xB18E00,0x1C1C1C,nil,true)
  468. ui.addTextArea(12,"",nil,10,92,30,20,0xCD0000,0x1C1C1C,nil,true)
  469. end
  470. end
  471. end
  472.  
  473. function eventKeyboard(name,key,down,x,y)
  474. if not moving and teclasProibidas[key] then
  475. tfm.exec.killPlayer(name)
  476. end
  477.  
  478. if (key==32) and not tfm.get.room.playerList[name].isDead then
  479. if p[name].timestamp < os.time()-10000 then
  480. local id
  481. if tfm.get.room.playerList[name].isFacingRight then
  482. id=tfm.exec.addShamanObject(p[name].using.id,x+13,y-10,0,0,0)
  483. else
  484. id=tfm.exec.addShamanObject(p[name].using.id,x-13,y-10,180,0,0)
  485. end
  486.  
  487. p[name].timestamp = os.time();
  488. else
  489. tfm.exec.chatMessage("Espere 10 segundos até spawnar um item novamente.",name)
  490. end
  491. end
  492. end
  493.  
  494. for all in pairs(tfm.get.room.playerList) do
  495. eventNewPlayer(all)
  496. end
  497.  
  498. tfm.exec.newGame(mapas[math.random(#mapas)])
  499. system.disableChatCommandDisplay("rank", true)
  500. system.disableChatCommandDisplay("help", true)
  501. system.disableChatCommandDisplay("p", true)
  502. system.disableChatCommandDisplay("ban", true)
  503. system.disableChatCommandDisplay("unban", true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement