Dudugz

[TFM][Minigame] Explosion v2.5

May 28th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.71 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}
  4. shaman = ""
  5.  
  6. data = {}
  7.  
  8. p={}
  9.  
  10. time_click = 0;
  11. vivos = 0;
  12. message=false
  13. g_time = 0;
  14.  
  15. --Funções--
  16.  
  17. tfm.exec.disableAutoNewGame(true)
  18. tfm.exec.disableAutoTimeLeft(true)
  19. tfm.exec.disableAllShamanSkills(true)
  20.  
  21. textarea=ui.addTextArea
  22. function ui.addTextArea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss)
  23. --if not backgroundColor then backgroundColor=0x324650 end
  24. --if not borderColor then borderColor=0x000001 end
  25. if emboss then
  26. textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha)
  27. textarea(7979+id,"",targetPlayer,x,y-1,width,height,0x6A8FA2,0x6A8FA2,backgroundAlpha)
  28. end
  29. textarea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha)
  30. end
  31.  
  32. function split(t,s)
  33.     local a={}
  34.     for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  35.         table.insert(a,i)
  36.     end
  37.     return a
  38. end
  39.  
  40.  
  41. function eventNewPlayer(name)
  42.     system.bindMouse(name,true)
  43.  
  44.     p[name]={
  45.         rounds=0,
  46.         Mwins=0,
  47.         Swins=0,
  48.         kills=0,
  49.         killer=0,
  50.     }
  51.  
  52.     for i,v in pairs(data) do
  53.         if v[1] == name then
  54.             p[name] = v[2]
  55.         end
  56.     end
  57.  
  58.     table.insert(data,{name, p[name]})
  59.    
  60.     eventChatCommand(name,'help')
  61.  
  62.     tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N><CE>Bem-vindo ao explosion v2.5</CE></N>",name)
  63.     tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N><VP>Este minigame foi reconstruido.</VP></N>",name)
  64.     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)
  65.     tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N>Este minigame foi desenvolvido por <V>Contistente</V> & <V>Rianmojang</V>.</N>",name)
  66.  
  67.     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.",name)
  68.     if not game then
  69.         tfm.exec.newGame(mapas[math.random(#mapas)])
  70.     end
  71.  
  72.    
  73. end
  74.  
  75. function eventChatCommand(name, cmd)
  76.     local arg = split(cmd, " ")
  77.    
  78.     if arg[1] == "help" or arg[1] == "ajuda" then
  79.         tfm.exec.chatMessage("<VP>→</VP> <V>[Help]</V> <J>Olhe a janela que abriu na sua tela.</J>",name)
  80.         ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
  81.         ui.addTextArea(1,'<B><J><font size="13">Como jogar',name,310,48,175,20,nil,0x324650,nil,true)
  82.         ui.addTextArea(2,'<p align="center"><R><a href="event:close">X</a>',name,466,50,16,16,0x324650,0x324650,nil,true)
  83.         ui.addTextArea(3,"<B><font size='12'>O jogo consiste em um shaman que é o <CE>Matador</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)
  84.     end
  85.  
  86.     if arg[1] == "p" then
  87.         if arg[2] then
  88.                 nome = arg[2]:lower():gsub('%a', string.upper, 1) -- guarda na variavel
  89.         else
  90.             nome = name
  91.         end
  92.  
  93.         if tfm.get.room.playerList[nome] then
  94.             ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
  95.             ui.addTextArea(1,'<B><J><font size="13">'..nome,name,310,48,175,20,nil,0x324650,nil,true)
  96.             ui.addTextArea(2,'<p align="center"><R><a href="event:close">X</a>',name,466,50,16,16,0x324650,0x324650,nil,true)
  97.             ui.addTextArea(3,"<B><font size='12'>Vezes Jogadas: "..p[nome].rounds.."<br>Vitórias como rato: "..p[nome].Mwins.."<br>Vitórias como matador: "..p[nome].Swins.."<br>Mortes: "..p[nome].kills.."<br>Vezes Matador: "..p[nome].killer.."",name,305,85,190,250,0x0e232b,0x0e232b,nil,true)
  98.         else
  99.             tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <R>"..nome.." não se encontra em sala ou não existe.</R>",name)
  100.         end
  101.     end
  102.  
  103. end
  104.  
  105. function eventPlayerLeft(name)
  106.     if name == shaman and game then
  107.         newMap()
  108.     end
  109. end
  110.  
  111. function newMap()
  112.     tfm.exec.newGame(mapas[math.random(#mapas)])
  113. end
  114.  
  115. function eventNewGame()
  116.     newShaman()
  117.     time_click = 2;
  118.     tfm.exec.setGameTime(100)
  119.     tfm.exec.snow(100)
  120. end
  121.  
  122. function eventPlayerDied(name)
  123.     vivos=vivos-1;
  124.  
  125.     p[name].kills = p[name].kills+1;
  126.  
  127.     if vivos == 1 and g_time > 30000 then
  128.         tfm.exec.setGameTime(31)
  129.     end
  130.  
  131.     if vivos == 0 then
  132.         jogadores={}
  133.        
  134.         for i in pairs(tfm.get.room.playerList) do
  135.             table.insert(jogadores,i)
  136.         end
  137.  
  138.         tfm.exec.setPlayerScore(jogadores[math.random(#jogadores)],16,false)
  139.         tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> O matador <VP>"..shaman.."</VP> é o vencedor.")
  140.         p[shaman].Swins = p[shaman].Swins+1;
  141.         newMap()
  142.     end
  143. end
  144.  
  145. function newShaman()
  146.     vivos=0
  147.     for i,v in pairs(tfm.get.room.playerList) do
  148.         if v.isShaman then
  149.             shaman = i
  150.         end
  151.         vivos=vivos+1;
  152.  
  153.         tfm.exec.giveMeep(i)
  154.     end
  155.  
  156.     if vivos > 2 then
  157.         game = true
  158.         for i in pairs(tfm.get.room.playerList) do
  159.             p[i].rounds = p[i].rounds+1;
  160.         end
  161.         p[shaman].killer = p[shaman].killer+1;
  162.         p[shaman].kills = p[shaman].kills-1;
  163.         tfm.exec.killPlayer(shaman)
  164.         tfm.exec.setPlayerScore(shaman,0,false)
  165.         tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N><CE>"..shaman.."</CE> é o matador.</N>")
  166.     else
  167.         game = false
  168.         tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <N><R>É necessário 3 jogadores.</N>")
  169.     end
  170. end
  171.  
  172. function eventMouse(name,x,y)
  173.     if time_click == 0 and name == shaman and game then
  174.         tfm.exec.explosion (x, y, math.random(20,30), 100, true)
  175.         tfm.exec.displayParticle(12,x,y)
  176.         for i=1,25 do
  177.             tfm.exec.displayParticle(0,x,y,math.random(-5,5),math.random(-5,5))
  178.         end
  179.         time_click = 4
  180.     end
  181. end
  182.  
  183. function eventTextAreaCallback(id,name,link)
  184.     if link=="close" then
  185.         for id=0,30 do
  186.             ui.removeTextArea(id,name)
  187.             ui.removeTextArea(6969+id,name)
  188.             ui.removeTextArea(7979+id,name)
  189.         end
  190.     end
  191. end
  192.  
  193. function eventLoop(t,r)
  194.     g_time = r
  195.     if t >= 3000 then
  196.         if time_click > 0 and game then
  197.             time_click = time_click-1;
  198.             message = false
  199.         elseif not message and time_click == 0 and game then
  200.             tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <J>Você pode explodir novamente.</J>",shaman)
  201.             message = true
  202.         end
  203.  
  204.         if vivos == 0 then
  205.             newMap()
  206.             vivos=1
  207.         end
  208.     end
  209.  
  210.     if r < 1000 then
  211.         for i,v in pairs(tfm.get.room.playerList) do
  212.             if not v.isDead and game then
  213.                 tfm.exec.giveCheese(i)
  214.                 tfm.exec.playerVictory(i)
  215.                 tfm.exec.chatMessage("<VP>→</VP> <V>[Message]</V> <VP>"..i.."</VP> é o vencedor.")
  216.                 p[i].Mwins = p[i].Mwins+1;
  217.             end
  218.         end
  219.  
  220.         vivos=vivos-1;
  221.  
  222.     end
  223.  
  224. end
  225.  
  226. for all in pairs(tfm.get.room.playerList) do
  227.     eventNewPlayer(all)
  228. end
  229.  
  230. tfm.exec.setRoomMaxPlayers(25)
  231. newMap()
Add Comment
Please, Sign In to add comment