Brenower

[TFM][Brenower][Mini game] Guerra de shamans

Jan 13th, 2014
460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 26.04 KB | None | 0 0
  1. -- Guerra de shamans
  2. -- Créditos:Brenower
  3. -- Tables
  4. data={};
  5. obj = {1,2,3,4,5,6,7,8,9,10,21,22,23,25,26,27,28,32,44};
  6. -- Data
  7. for player in pairs(tfm.get.room.playerList) do
  8.     newData={
  9.      ["team"]="...";
  10.      ["score"]=0;
  11.      ["title"]="...";
  12.      ["wins"]=0;
  13.      ["admin"]=false;
  14.      ["banned"]=false;
  15.      ["powerup"]=0;
  16.      ["time"]=os.time();
  17.     };
  18.     data[player] = newData;
  19. end
  20. alive=0;
  21. minigame={
  22.     ["version"]="1.5";
  23.     ["creators"]="Brenower and Laagaadoo";
  24.     ["alivet1"]=0;
  25.     ["alivet2"]=0;
  26.     ["currentMap"]=0;
  27.     ["win"]=false;
  28. };
  29. lobby={"4621649"};
  30. war={"4621649","4622871",};
  31. lang={
  32.     BR={
  33.         ["help1"]="<TI><J>• Objetivo:<font size='11'><N2><br />Matar todos os shamans da equipe oponente.</font><br /><TI><J>• Como jogar:<font size='11'><N2><br />Invoque canhões para matar a equipe oponente e assim ganhar a partida.</font><br /><TI><J>• Mais informações:<N2><font size='11'><br />A cada partida ganha você ganha 1 ponto e é contado em seu perfil que mais uma partida foi ganha.</font><br /><TI><J>• Alguns comandos:<font size='11'><V>!pwp help <G>-<N2> Mostra as informaçõe sobre powerups.<br /><V>!shop help<G> -<N2> mostra informações sobre a loja.";
  34.         ["help2"]="<TI><J>• Comandos:<font size='11'><N2><br /><V>!perfil NOMEDOJOGADOR(ou me) <G>- <N2>Mostra as estasticas do jogador citado, caso seja usado o <V>!perfil me<N2> mostra as suas estatisticas.<br /><V>!help <G>-<N2> Mostra como jogar o mini game e etc.<br /><V>!msg MENSAGEM <G>-<N2> Envia uma mensagem para a sua equipe.<br /><V>!pwp help <G>-<N2> Mostra informaçõe sobre os powerups.</font><br /><TI><J>• Créditos:<font size='11'><N2><br />Brenower, Laagaadoo.<br /><J>Agradecimentos:<N2>Fluffyshine(ideias).</font>";
  35.         ["powerup"]="<TI><J>• O que é?<font size='11'><N2><br />Powerups é upgrades que melhoram sua perfomance pelo mini game.</font><br /><TI><J>• Como ganhar um?<font size='11'><N2><br />Basta falar no chat <V>!pwp choose<N2> e escolher seu powerup.</font><br /><TI><J>• Perguntas frequentes<font size='11'><br /><VP>1.Quantos powerups posso escolher?<N2>Apenas um.<br /><VP>2.O que o powerup 1 faz?<N2>Ele deixa você voar pelo mapa por 5 segundos.<br /><VP>3.O que o powerup 2 faz?<N2>Ele deixa você mais rápido por 5 segundos.<br /><VP>3.O que o powerup 3 faz?<N2>Você pode se teleportar pelo mapa a cada 5 segundos.</font>";
  36.         ["pwpch"]="<TI><J>• Escolha um powerup:<font size='11'><V><br /><a href='event:p1'>Powerup 1 - Deixa você voar pelo mapa por 5 segundos.</a><br /><br /><a href='event:p2'>Powerup 2 - Deixa você andar pelo mapa mais rápido por 5 segundos.</a><br /><br /><a href='event:p3'>Powerup 3 - Você pode se teleportar pelo mapa a cada 5 segundos.</a></font><br /><TI><J>• Observações:<N2><font size='11'>*Para escolhe um powerup é preciso estar no lobby, para usar o powerup 3 clique em algum lugar com o mouse, para usar o powerup 1 e 2 aperte espaço.</font>";
  37.         ["shoph"]="<font size='12'><J>• O que é?<font size='11'><N2><br />É uma loja de titles onde você pode comprar-los pelos mais variados preços.<br /><font size='12'><J>• Como posso comprar-los?<N2><font size='11'><br />Fale <V>!shop buy<N2> e clique no que você deseja comprar.<br /><font size='12'><J>• Como posso ver meu title ou de outro jogador?<br /><N2><font size='11'>Use o comando <V>!perfil me<N2> para ver seu title e o comando <V>!perfil NOMEDOJOGADOR<N2> para ver o title de outro jogador.<br /><J><font size='12'>• Como posso ganhar pontos?<font size='11'><N2><br />Ganhando partidas, a cada uma partida ganha você ganha 3 pontos.";
  38.         ["shop"]="<TI><J>• Loja de títulos:<font size='11'><N2><br /><a href='event:s1'>Guerreiro Novato <G>-<V> 1 pontos.</a><br /><a href='event:s2'><N2>Guerreiro aprendiz <G>-<V> 5 pontos.</a><br /><N2><a href='event:s3'><N2>CN Master <G>-<V> 25 Pontos</a></font>";
  39.         ["buys"]="<p align='center'><font color='#2ECF73'>Compra efetuada!</font></p>";
  40.         ["buye"]="<p algn='center'><font color='#CB546B'>Não foi possível realizar a compra. :(</font></p>";
  41.         ["chat"]="<VP>Chat para <R>adms<VP> e <J>equipes<VP>.";
  42.         ["newtitle"]="<VP>Você ganhou um novo <CH>título<VP>!";
  43.         ["warstarted"]="<VP> A <G>guerra<VP> começou, lutem!";
  44.         ["teams"]={"Azul","Rosa"};
  45.         ["team1"]="Azul";
  46.         ["team2"]="Rosa";
  47.         ["stats"]="";
  48.         ["statsme"]="";
  49.         ["lobby"]="<VP>Bem vindo ao <CH>Guerra de Shamans<VP>!<br /><R>[~Lua]<VP> Seu time atual é o <J>";
  50.         ["team1won"]="<VP> A equipe <J>azul<VP> ganhou!";
  51.         ["team2won"]="<VP> A equipe <J>rosa<VP> ganhou!";
  52.         ["object"]="<VP>A invocaçâo deste objeto não é permitida!";
  53.         ["minigame"]="Guerra de shamans";
  54.         ["title1"]="Guerreiro novato";
  55.         ["title2"]="Guerreiro aprendiz";
  56.         ["title3"]="CN Master";
  57.         ["stats1"]="<font color='#6C77C1'>• Equipe atual : </font>";
  58.         ["stats2"]="<font color='#6C77C1'>• Partidas vencidas : </font>";
  59.         ["stats3"]="<font color='#6C77C1'>• Pontos : </font>";
  60.         ["stats4"]="<font color='#6C77C1'>• Título atual : </font>";
  61.         ["escbug"]="<VP>Sem uso de <J>bugs<VP>!";
  62.     };
  63. EN={
  64.     ["help1"]="<TI><J>• Objective:<font size='11'><N2><br />Kill all shamans of the opponent team.</font><br /><TI><J>• How to play:<font size='11'><N2><br />Invoke cannons to kill the opponent team and win the match.</font><br /><TI><J>• More information:<N2><font size='11'><br />For each match won, you earn 1 point.</font><br /><TI><J>• Some commands:<font size='11'><V>!pwp help <G>-<N2> Shows the information about power ups.<br /><V>!loja help<G> -<N2> Shows the information about the shop.";
  65.     ["help2"]="<TI><J>• Commands:<font size='11'><N2><br /><V>!perfil NAMEOFPLAYER(or me) <G>- <N2>Shows the statistics about the player cited. If you use <V>!perfil me<N2>, it shows your profile.<br /><V>!help <G>-<N2> Shows the information about the minigame.<br /><V>!msg MESSAGE <G>-<N2> Sends a message to your team.<br /><V>!pwp help <G>-<N2> Shows the information about power ups.</font><br /><TI><J>• Credits:<font size='11'><N2><br />Brenower, Laagaadoo.<br /><J>Thanks: <N2>Fluffyshine(ideas).</font>";
  66.     ["powerup"]="<TI><J>• What is?<font size='11'><N2><br />Power ups is upgrades that improve their performance at minigame.</font><br /><TI><J>• How to earn one?<font size='11'><N2><br />Type <V>!pwp choose<N2> and choose your power up.</font><br /><TI><J>• Frequent Questions<font size='11'><br /><VP>1.How many powerups can I have?<N2>Only one.<br /><VP>2.What makes the first power up?<N2>It allow that you can fly by 5 seconds.<br /><VP>3.What makes the second power up?<N2>It increases your velocity by 5 seconds.<br /><VP>3.What makes the third power up?<N2>It allow you teleport by map each 5 seconds.</font>";
  67.     ["pwpch"]="<TI><J>• Choose a power up:<font size='11'><V><br /><a href='event:p1'>Power up 1 - Allows you fly by 5 seconds.</a><br /><br /><a href='event:p2'>Power up 2 - Increases your velocity by 5 seconds.</a><br /><br /><a href='event:p3'>Power up 3 - Allows teleport by map each 5 seconds.</a></font><br /><TI><J>• Note:<N2><font size='11'>*To choose a power up you need to be in the lobby, to use the third power up, click in the map, to use the first and the second power up, press space.</font>";
  68.     ["shoph"]="<font size='12'><J>• What is?<font size='11'><N2><br />It's a shop of titles that you can buy titles.<br /><font size='12'><J>• How to buy?<N2><font size='11'><br />Type <V>!shop buy<N2> and click in the that you want buy.<br /><font size='12'><J>• How to see my title or of other player?<br /><N2><font size='11'>Type <V>!perfil me<N2> to see your title. Type <V>!perfil NAMEOFPLAYER<N2> to see the title of other player.<br /><J><font size='12'>• How to earn points?<font size='11'><N2><br />Winning matches, for each match won you earn three points.";
  69.     ["shop"]="<TI><J>• Shop of titles:<font size='11'><N2><br /><a href='event:s1'>Novice Warrior <G>-<V> One point.</a><br /><a href='event:s2'><N2>Apprentice Warrior <G>-<V> Five points.</a><br /><N2><a href='event:s3'><N2>Cannon Master <G>-<V> Twenty-five points</a></font>";
  70.     ["buys"]="<p align='center'><font color='#2ECF73'>Purchased successfully!</font></p>";
  71.     ["buye"]="<p algn='center'><font color='#CB546B'>Unable to make the purchase. :(</font></p>";
  72.     ["chat"]="<VP>Chat for <R>admins<VP> and <J>teams<VP>.";
  73.     ["newtitle"]="<VP>You earned a new <CH>title<VP>!";
  74.     ["warstarted"]="<VP> The <G>war<VP> has started, fight!";
  75.     ["teams"]={"Blue","Pink"};
  76.     ["team1"]="Blue";
  77.     ["team2"]="Pink";
  78.     ["stats"]="";
  79.     ["statsme"]="";
  80.     ["lobby"]="<VP>Welcome to the <CH>War of Shamans<VP>!<br /><R>[~Lua]<VP> Your current team is <J>";
  81.     ["team1won"]="<VP> The <J>blue<VP> team has won!";
  82.     ["team2won"]="<VP> The <J>pink<VP> team has won!";
  83.     ["object"]="<VP>This object is not allowed!";
  84.     ["minigame"]="Guerra de shamans";
  85.     ["title1"]="Novice Warrior";
  86.     ["title2"]="Apprentice Warrior";
  87.     ["title3"]="Cannon Master";
  88.     ["stats1"]="<font color='#6C77C1'>• Current team : </font>";
  89.     ["stats2"]="<font color='#6C77C1'>• Matches won : </font>";
  90.     ["stats3"]="<font color='#6C77C1'>• Points : </font>";
  91.     ["stats4"]="<font color='#6C77C1'>• Current title : </font>";
  92.     ["escbug"]="<VP>No use of <J>bugs<VP>!";
  93. };
  94. INT={
  95.     ["help1"]="<TI><J>• Objective:<font size='11'><N2><br />Kill all shamans of the opponent team.</font><br /><TI><J>• How to play:<font size='11'><N2><br />Invoke cannons to kill the opponent team and win the match.</font><br /><TI><J>• More information:<N2><font size='11'><br />For each match won, you earn 1 point.</font><br /><TI><J>• Some commands:<font size='11'><V>!pwp help <G>-<N2> Shows the information about power ups.<br /><V>!loja help<G> -<N2> Shows the information about the shop.";
  96.     ["help2"]="<TI><J>• Commands:<font size='11'><N2><br /><V>!perfil NAMEOFPLAYER(or me) <G>- <N2>Shows the statistics about the player cited. If you use <V>!perfil me<N2>, it shows your profile.<br /><V>!help <G>-<N2> Shows the information about the minigame.<br /><V>!msg MESSAGE <G>-<N2> Sends a message to your team.<br /><V>!pwp help <G>-<N2> Shows the information about power ups.</font><br /><TI><J>• Credits:<font size='11'><N2><br />Brenower, Laagaadoo.<br /><J>Thanks: <N2>Fluffyshine(ideas).</font>";
  97.     ["powerup"]="<TI><J>• What is?<font size='11'><N2><br />Power ups is upgrades that improve their performance at minigame.</font><br /><TI><J>• How to earn one?<font size='11'><N2><br />Type <V>!pwp choose<N2> and choose your power up.</font><br /><TI><J>• Frequent Questions<font size='11'><br /><VP>1.How many powerups can I have?<N2>Only one.<br /><VP>2.What makes the first power up?<N2>It allow that you can fly by 5 seconds.<br /><VP>3.What makes the second power up?<N2>It increases your velocity by 5 seconds.<br /><VP>3.What makes the third power up?<N2>It allow you teleport by map each 5 seconds.</font>";
  98.     ["pwpch"]="<TI><J>• Choose a power up:<font size='11'><V><br /><a href='event:p1'>Power up 1 - Allows you fly by 5 seconds.</a><br /><br /><a href='event:p2'>Power up 2 - Increases your velocity by 5 seconds.</a><br /><br /><a href='event:p3'>Power up 3 - Allows teleport by map each 5 seconds.</a></font><br /><TI><J>• Note:<N2><font size='11'>*To choose a power up you need to be in the lobby, to use the third power up, click in the map, to use the first and the second power up, press space.</font>";
  99.     ["shoph"]="<font size='12'><J>• What is?<font size='11'><N2><br />It's a shop of titles that you can buy titles.<br /><font size='12'><J>• How to buy?<N2><font size='11'><br />Type <V>!shop buy<N2> and click in the that you want buy.<br /><font size='12'><J>• How to see my title or of other player?<br /><N2><font size='11'>Type <V>!perfil me<N2> to see your title. Type <V>!perfil NAMEOFPLAYER<N2> to see the title of other player.<br /><J><font size='12'>• How to earn points?<font size='11'><N2><br />Winning matches, for each match won you earn three points.";
  100.     ["shop"]="<TI><J>• Shop of titles:<font size='11'><N2><br /><a href='event:s1'>Novice Warrior <G>-<V> One point.</a><br /><a href='event:s2'><N2>Apprentice Warrior <G>-<V> Five points.</a><br /><N2><a href='event:s3'><N2>Cannon Master <G>-<V> Twenty-five points</a></font>";
  101.     ["buys"]="<p align='center'><font color='#2ECF73'>Purchased successfully!</font></p>";
  102.     ["buye"]="<p algn='center'><font color='#CB546B'>Unable to make the purchase. :(</font></p>";
  103.     ["chat"]="<VP>Chat for <R>admins<VP> and <J>teams<VP>.";
  104.     ["newtitle"]="<VP>You earned a new <CH>title<VP>!";
  105.     ["warstarted"]="<VP> The <G>war<VP> has started, fight!";
  106.     ["teams"]={"Blue","Pink"};
  107.     ["team1"]="Blue";
  108.     ["team2"]="Pink";
  109.     ["stats"]="";
  110.     ["statsme"]="";
  111.     ["lobby"]="<VP>Welcome to the <CH>War of Shamans<VP>!<br /><R>[~Lua]<VP> Your current team is <J>";
  112.     ["team1won"]="<VP> The <J>blue<VP> team has won!";
  113.     ["team2won"]="<VP> The <J>pink<VP> team has won!";
  114.     ["object"]="<VP>This object is not allowed!";
  115.     ["minigame"]="Guerra de shamans";
  116.     ["title1"]="Novice Warrior";
  117.     ["title2"]="Apprentice Warrior";
  118.     ["title3"]="Cannon Master";
  119.     ["stats1"]="<font color='#6C77C1'>• Current team : </font>";
  120.     ["stats2"]="<font color='#6C77C1'>• Matches won : </font>";
  121.     ["stats3"]="<font color='#6C77C1'>• Points : </font>";
  122.     ["stats4"]="<font color='#6C77C1'>• Current title : </font>";
  123.     ["escbug"]="<VP>No use of <J>bugs<VP>!";
  124. };
  125. };
  126. cmm = tfm.get.room.community
  127. win=false;
  128. -- Script inicial
  129. ui.addTextArea(8,"<a href='event:help'><font size='14'><p align='center'><b>?</b></font></p></a>",NIL,775,70,20,17,1,1,0.9,true)
  130. tfm.exec.disableAutoShaman(true)
  131. tfm.exec.disableAutoNewGame(true)
  132. tfm.exec.disableAutoTimeLeft(true)
  133. tfm.exec.disableAllShamanSkills(true)
  134. tfm.exec.newGame(lobby[math.random(#lobby)])
  135.     system.disableChatCommandDisplay("perfil",true)
  136.     system.disableChatCommandDisplay("ban",true)
  137.     system.disableChatCommandDisplay("msg",true)
  138.     system.disableChatCommandDisplay("txt",true)
  139.     system.disableChatCommandDisplay("unban",true)
  140.     system.disableChatCommandDisplay("stats",true)
  141. -- New game
  142. function eventNewGame()
  143.     alive=0;
  144.     for players in pairs(tfm.get.room.playerList) do
  145.         alive=alive+1;
  146.         tfm.exec.bindKeyboard(players,27,true,true)
  147.         tfm.exec.bindKeyboard(players,32,true,true)
  148.         system.bindMouse(players,true)
  149.         if data[players].banned == true then
  150.             tfm.exec.killPlayer(player)
  151.         end
  152.     end
  153.     minigame.currentMap=minigame.currentMap+1;
  154.     ui.addTextArea(2,"<p align='center'><R>[~Lua] "..lang[cmm].chat.."",NIL,5,380,750,35,0,0,1,true)
  155.     if minigame.currentMap == 1 then
  156.         eventLobby()
  157.     end
  158.     if minigame.currentMap == 2 then
  159.         eventWar()
  160.     end
  161.     if minigame.currentMap == 3 then
  162.         eventLobby()
  163.     end
  164. end
  165. -- lobby
  166. function eventLobby()
  167.     minigame.currentMap=1;
  168.     tfm.exec.setGameTime(30)
  169.     eventTeam()
  170. end
  171. -- Selecionar equipe
  172. function eventTeam()
  173.         local Players = {}
  174.  
  175.         for playerName in pairs(tfm.get.room.playerList) do
  176.                 table.insert(Players, playerName)
  177.                 tfm.exec.setNameColor(playerName,0x9292AA)
  178.         end
  179.  
  180.         for i = 1, #Players, 1 do
  181.                 local random= math.random(#Players)
  182.                 local Nome = Players[random]
  183.                 if(i%2 == 0) then
  184.                         data[Nome].team = ""..lang[cmm].team2.."";
  185.                 else
  186.                         data[Nome].team = ""..lang[cmm].team1.."";
  187.                 end
  188.                 table.remove(Players, random)
  189.         end
  190.         for player in pairs(tfm.get.room.playerList) do
  191.         ui.addTextArea(1,"<p align='center'>"..lang[cmm].lobby.."<J>"..data[player].team.."<VP>!</p>",player,5,25,750,35,0,0,1,true)
  192. end
  193. end
  194. -- Guerra
  195. function eventWar()
  196.     win=false;
  197.     minigame.alive=0;
  198.     minigame.alivet1=0;
  199.     minigame.alivet2=0;
  200.     ui.updateTextArea(1,"<p align='center'><R>[~Lua] "..lang[cmm].warstarted.."</p>",NIL)
  201.     eventTeams()
  202. end
  203. -- Ver equipe
  204. function eventTeams()
  205.     for player in pairs(tfm.get.room.playerList) do
  206.         if data[player].team == lang[cmm].team1 then
  207.             tfm.exec.setShaman(player)
  208.             tfm.exec.setNameColor(player,0x98E2EB)
  209.             minigame.alivet1=minigame.alivet1+1;
  210.         end
  211.         if data[player].team == lang[cmm].team2 then
  212.             tfm.exec.setShaman(player)
  213.             tfm.exec.setNameColor(player,0xFEB1FC)
  214.             minigame.alivet2=minigame.alivet2+1;
  215.         end
  216.         if data[player].team == "..." then
  217.             tfm.exec.killPlayer(player)
  218.         end
  219.     end
  220. end
  221. -- Comandos
  222. function eventChatCommand(player,cm)
  223.     if data[player].admin == true or player == [[Brenower]] then
  224.         if (cm:sub(0,3) == [[txt]]) then
  225.             ui.updateTextArea(2,"<p align='center'><R>[~Adm]<V> ["..player.."]<N2> "..cm:sub(5).."",NIL)
  226.         end
  227.         if (cm:sub(0,3) == [[adm]]) then
  228.             for str,num in pairs(tfm.get.room.playerList) do
  229.                 if (str == cm:sub(5)) then
  230.                     data[str].admin = true;
  231.                 end
  232.             end
  233.         end
  234.         if (cm:sub(0,3) == [[ban]]) then
  235.             for str,num in pairs(tfm.get.room.playerList) do
  236.                 if (str == cm:sub(5)) then
  237.                     data[str].banned = true;
  238.                     tfm.exec.killPlayer(str)
  239.                 end
  240.             end
  241.         end
  242.         if (cm:sub(0,5) == [[unban]]) then
  243.             for str,num in pairs(tfm.get.room.playerList) do
  244.                 if (str == cm:sub(7)) then
  245.                     data[str].banned = false;
  246.                 end
  247.             end
  248.         end
  249.         if (cm:sub(0,5) == [[title]]) then
  250.         data[player].title = ""..cm:sub(7).."";
  251.         end
  252.     end
  253.     if (cm:sub(0,3) == [[msg]]) then
  254.         for players in pairs(tfm.get.room.playerList) do
  255.         if data[player].team == lang[cmm].team1 then
  256.             for players in pairs(tfm.get.room.playerList) do
  257.             if data[players].team == lang[cmm].team1 then
  258.             ui.updateTextArea(2,"<p align='center'><font color='#98E2EB'>[~"..lang[cmm].team1.."]</font><V> ["..player.."]<N2> "..cm:sub(5).."",players)
  259.         end
  260.     end
  261.     end
  262.         if data[player].team == lang[cmm].team2 then
  263.             if data[players].team == lang[cmm].team2 then
  264.                 for players in pairs(tfm.get.room.playerList) do
  265.             ui.updateTextArea(2,"<p align='center'><font color='#FEB1FC'>[~"..lang[cmm].team2.."]</font><V> ["..player.."]<N2> "..cm:sub(5).."",players)
  266.         end
  267.     end
  268.     end
  269.     end
  270. end
  271.     if cm == "help" or cm == "ajuda" then
  272.         eventTextAreaCallback(8,player,"help")
  273. end
  274.     if (cm:sub(0,5) == [[stats]] or cm:sub(0,6) == [[perfil]]) then
  275.         for str,num in pairs(tfm.get.room.playerList) do
  276.             if (str == cm:sub(7) or str == cm:sub(8)) then
  277.         ui.addPopup(1,0,"<p align='center'><font size='18' face='Soopafresh'>"..str.."</font></p><br />"..lang[cmm].stats1.."<font color='#BABD2F'>"..data[str].team.."<br />"..lang[cmm].stats2..""..data[str].wins.."<br />"..lang[cmm].stats3..""..data[str].score.."<br />"..lang[cmm].stats4..""..data[str].title.."</font>",player,300,175,230)
  278.             end
  279.             if (cm:sub(7) == [[me]] or cm:sub(8) == [[me]]) then
  280.             ui.addPopup(1,0,"<p align='center'><font size='18' face='Soopafresh'>"..player.."</font></p><br />"..lang[cmm].stats1.."<font color='#BABD2F'>"..data[player].team.."<br />"..lang[cmm].stats2..""..data[player].wins.."<br />"..lang[cmm].stats3..""..data[player].score.."<br />"..lang[cmm].stats4..""..data[player].title.."</font>",player,300,175,230)
  281.             end
  282.         end
  283.     end
  284.     if (cm:sub(0,3) == [[pwp]]) then
  285.     if (cm:sub(5) == [[help]]) then
  286.     ui.addTextArea(9,"<p align='center'>"..lang[cmm].powerup.."</p>",player,275,100,250,215,1,1,0.8,true)
  287.     ui.addTextArea(10,"<p align='center'><a href='event:closep'><b>X</b></a></p>",player,275,73,15,15,1,1,0.8,true)
  288.     end
  289.     if (cm:sub(5) == [[choose]]) then
  290.     ui.addTextArea(11,"<p align='center'>"..lang[cmm].pwpch.."</p>",player,275,100,250,200,1,1,0.8,true)
  291.     ui.addTextArea(12,"<p align='center'><a href='event:closepc'><b>X</b></a></p>",player,275,73,15,15,1,1,0.8,true)
  292.     end
  293.     end
  294.     if (cm:sub(0,4) == [[shop]]) then
  295.     if (cm:sub(6) == [[help]]) then
  296.     ui.addTextArea(13,"<p align='center'>"..lang[cmm].shoph.."</p>",player,275,100,260,200,1,1,0.8,true)
  297.     ui.addTextArea(14,"<p align='center'><a href='event:closes'><b>X</b></a></p>",player,275,73,15,15,1,1,0.8,true)
  298.     end
  299.     if (cm:sub(6) == [[buy]]) then
  300.     ui.addTextArea(15,"<p align='center'>"..lang[cmm].shop.."</p>",player,275,100,250,200,1,1,0.8,true)
  301.     ui.addTextArea(16,"<p align='center'><a href='event:closes2'><b>X</b></a></p>",player,275,73,15,15,1,1,0.8,true)
  302.     end
  303.     end
  304. end
  305. -- Loop
  306. function eventLoop(ct,rt)
  307.     if minigame.currentMap == 1 then
  308.         if rt <= 0 then
  309.             tfm.exec.newGame(war[math.random(#war)])
  310.         end
  311.         if alive == 0 then
  312.             tfm.exec.newGame(war[math.random(#war)])
  313.         end
  314.     end
  315.     if minigame.currentMap == 2 then
  316.         if rt <= 0 then
  317.             tfm.exec.newGame(lobby[math.random(#lobby)])
  318.         end
  319.         if alive == 0 then
  320.             tfm.exec.newGame(lobby[math.random(#lobby)])
  321.         end
  322.     end
  323. end
  324. -- Jogador morre
  325. function eventPlayerDied(player)
  326.     alive=alive-1;
  327.     if minigame.currentMap == 2 then
  328.         tfm.exec.setUIShamanName("<BL>   |   <CH>"..lang[cmm].team1.." : <N2>"..minigame.alivet1.."   <BL>|  <font color='#FEB1FC'>"..lang[cmm].team2.." :<N2> "..minigame.alivet2.."")
  329.     if data[player].team == lang[cmm].team1 then
  330.         minigame.alivet1=minigame.alivet1-1;
  331.     end
  332.     if data[player].team == lang[cmm].team2 then
  333.         minigame.alivet2=minigame.alivet2-1;
  334.     end
  335.     tfm.exec.setUIShamanName("<G>* |   <CH>"..lang[cmm].team1.." : <N2>"..minigame.alivet1.."   <G>|  <font color='#FEB1FC'>"..lang[cmm].team2.." :<N2> "..minigame.alivet2.."")
  336.     if win == false then
  337.         if minigame.alivet1 == 0 then
  338.             ui.updateTextArea(1,"<R>[~Lua] "..lang[cmm].team2won.."",NIL)
  339.             tfm.exec.setGameTime(15)
  340.             win=true;
  341.         for players in pairs(tfm.get.room.playerList) do
  342.             if data[players].team == lang[cmm].team2 then
  343.                 data[players].wins = data[player].wins+1;
  344.                 data[players].score = data[players].score+3;
  345.             end
  346.         end
  347.         end
  348.         if minigame.alivet2 == 0 then
  349.         ui.updateTextArea(1,"<R>[~Lua] "..lang[cmm].team1won.."",NIL)
  350.         tfm.exec.setGameTime(15)
  351.         win=true;
  352.         for players in pairs(tfm.get.room.playerList) do
  353.             if data[players].team == lang[cmm].team1 then
  354.                 data[players].wins = data[player].wins+1;
  355.                 data[players].score = data[players].score+3;
  356.             end
  357.         end
  358.     end
  359.     end
  360. end
  361. end
  362. -- Jogador termina de invocar algo
  363. function eventSummoningEnd(player,Obje,xPosition,yPosition,angle,xSpeed,ySpeed,other)
  364. for index,objs in pairs(obj) do
  365.     if objs == Obje then
  366.     tfm.exec.removeObject(other.id)
  367. end
  368. end
  369. end
  370. -- Esc bug
  371. function eventKeyboard(player,key,down,x,y)
  372.     if key == 27 then
  373.         if down == true then
  374.         tfm.exec.killPlayer(player)
  375.         ui.updateTextArea(1,"<R>[~Lua] "..lang[cmm].escbug.."",player)
  376.     end
  377. end
  378. if tfm.get.room.playerList[player].y >= 65 then
  379. if key == 32 then
  380. if data[player].powerup == 1 and data[player].time < os.time()-5000 and minigame.currentMap == 2 then
  381. tfm.exec.movePlayer(player,xx,yy,false,0,-50,false)
  382. if data[player].time < os.time()-10000 then
  383. data[player].time = os.time();
  384. end
  385. end
  386. if data[player].powerup == 2 and data[player].time < os.time()-5000 and minigame.currentMap == 2 then
  387. if tfm.get.room.playerList[player].isFacingRight then
  388. tfm.exec.movePlayer(player,xx,yy,false,50,0,false)
  389. else
  390. tfm.exec.movePlayer(player,xx,yy,false,-50,0,false)
  391. end
  392. if data[player].time < os.time()-10000 then
  393. data[player].time = os.time();
  394. end
  395. end
  396. end
  397. end
  398. end
  399. -- Novo jogador entra na sala
  400. function eventNewPlayer(player)
  401.     if not data[player] then
  402.     newData={
  403.      ["team"]="...";
  404.      ["score"]=0;
  405.      ["title"]="...";
  406.      ["wins"]=0;
  407.      ["admin"]=false;
  408.      ["banned"]=false;
  409.      ["powerup"]=0;
  410.      ["time"]=os.time();
  411.     };
  412.     data[player] = newData;
  413.     end
  414.     ui.addTextArea(8,"<a href='event:help'><font size='14'><p align='center'><b>?</b></font></p></a>",NIL,775,70,20,17,1,1,0.9,true)
  415. end
  416. -- Links de uma textarea
  417. function eventTextAreaCallback(id,player,link)
  418. if link == "help" then
  419. ui.addTextArea(4,"<p align='center'>"..lang[cmm].help1.."</p>",player,275,100,250,200,1,1,0.8,true)
  420. ui.addTextArea(5,"<p align='center'><a href='event:closeh'><b>X</b></a></p>",player,275,73,15,15,1,1,0.8,true)
  421. ui.addTextArea(6,"<p align='center'><b>&lt;</b></p>",player,305,73,15,15,1,1,0.8,true)
  422. ui.addTextArea(7,"<p align='center'><b><a href='event:pag2'>></a></b></p>",player,335,73,15,15,1,1,0.8,true)
  423. end
  424. if minigame.currentMap == 1 then
  425. if link == "p1" then
  426. data[player].powerup = 1;
  427. ui.removeTextArea(11,player)
  428. ui.removeTextArea(12,player)
  429. end
  430. if link == "p2" then
  431. data[player].powerup = 2;
  432. ui.removeTextArea(11,player)
  433. ui.removeTextArea(12,player)
  434. end
  435. if link == "p3" then
  436. data[player].powerup = 3;
  437. ui.removeTextArea(11,player)
  438. ui.removeTextArea(12,player)
  439. end
  440. end
  441. if link == "closeh" then
  442. ui.removeTextArea(4,player)
  443. ui.removeTextArea(5,player)
  444. ui.removeTextArea(6,player)
  445. ui.removeTextArea(7,player)
  446. end
  447. if link == "pag2" then
  448. ui.updateTextArea(4,"<p align='center'>"..lang[cmm].help2.."</p>",player)
  449. ui.updateTextArea(6,"<p align='center'><a href='event:help'>&lt;</a></p>",player)
  450. end
  451. if link == "closep" then
  452. ui.removeTextArea(9,player)
  453. ui.removeTextArea(10,player)
  454. end
  455. if link == "closepc" then
  456. ui.removeTextArea(11,player)
  457. ui.removeTextArea(12,player)
  458. end
  459. if link == "s1" then
  460. eventBuyTitle(player,1)
  461. end
  462. if link == "s2" then
  463. eventBuyTitle(player,2)
  464. end
  465. if link == "s3" then
  466. eventBuyTitle(player,3)
  467. end
  468. if link == "closes" then
  469. ui.removeTextArea(13,player)
  470. ui.removeTextArea(14,player)
  471. end
  472. if link == "closes2" then
  473. ui.removeTextArea(15,player)
  474. ui.removeTextArea(16,player)
  475. end
  476. end
  477. -- Eventos do mouse
  478. function eventMouse(player,x,y)
  479. if y >= 65 and y <= 368 then
  480. if data[player].powerup == 3 and minigame.currentMap == 2 and data[player].time < os.time()-5000 then
  481. tfm.exec.movePlayer(player,x,y,false,0,0,false)
  482. data[player].time = os.time();
  483. end
  484. end
  485. end
  486. -- Compras da loja
  487. function eventBuyTitle(player,id)
  488. ui.removeTextArea(15,player)
  489. ui.removeTextArea(16,player)
  490. if id == 1 and data[player].score >= 1 then
  491. data[player].title = ""..lang[cmm].title1.."";
  492. ui.addPopup(2,0,lang[cmm].buys,player,300,175,200)
  493. data[player].score = data[player].score-1;
  494. else
  495. ui.addPopup(2,0,lang[cmm].buye,player,300,175,200)
  496. end
  497. if id == 2 and data[player].score >= 5 then
  498. data[player].title = ""..lang[cmm].title2.."";
  499. ui.addPopup(2,0,lang[cmm].buys,player,300,175,200)
  500. data[player].score = data[player].score-5;
  501. else
  502. ui.addPopup(2,0,lang[cmm].buye,player,300,175,200)
  503. end
  504. if id == 3 and data[player].score >= 25 then
  505. data[player].title = ""..lang[cmm].title3.."";
  506. ui.addPopup(2,0,lang[cmm].buys,player,300,175,200)
  507. data[player].score = data[player].score-25;
  508. else
  509. ui.addPopup(2,0,lang[cmm].buye,player,300,175,200)
  510. end
  511. end
Advertisement
Add Comment
Please, Sign In to add comment