Advertisement
NewHP

#Fast Atualizado²

Jul 20th, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.41 KB | None | 0 0
  1. -----------------------------
  2. -- @Alguns valores de armazenamento e dados.
  3. -- @Desabilita algumas funções do jogo.
  4. --@ Auto shaman, Auto new game, Auto time left, Consumiveis, Auto morte, afk morte, Auto score.
  5. -----------------------------
  6. for _, v in next, {'AutoShaman', 'AutoNewGame', 'AutoTimeLeft', 'PhysicalConsumables', 'AfkDeath', 'MortCommand', 'AutoScore'} do
  7.     tfm.exec['disable' .. v]()
  8. end
  9. -----------------------------
  10. --@ Algumas variaveis
  11. -----------------------------
  12. newData = {}
  13. deleteObject = {}
  14. tempo = os.time()
  15. p = 0
  16. proom = 0
  17. blue = 0
  18. red = 0
  19. -- @Inicio do jogo
  20. StartTime=false
  21. startGame=false
  22. -----------------------------
  23. --@ Mapas racing
  24. -----------------------------
  25. maps={"@4953687","@5032745","@1979131","@260384","@5650267","@229827","@161730","@3638794","@1856349","@4238784","@4148332","@210188","@1368233 ","@214660","@1525272","@1637638 ","@327130","@556426","@208914"}
  26. -----------------------------
  27. --@ Novo jogador
  28. -----------------------------
  29. function eventNewPlayer(name)
  30.   proom=proom+1
  31.     newData[name] = {
  32.       Team = "",
  33.       XP = 0,
  34.       Level = 0,
  35.       Life = 3,
  36.       lang = "",
  37.       tempo = os.time(),
  38.     }
  39. -----------------------------
  40. -- @System que define quem ganha a partida
  41. -----------------------------
  42. function eventLoop(currentTime,timeRemaining)
  43.   for _,obj in ipairs(deleteObject) do
  44.       if obj.time < os.time()-4000 then
  45.           tfm.exec.removeObject(obj.id)
  46.           table.remove(deleteObject,_)
  47.       end
  48.     end
  49.   if (startTime) then
  50.       if (timeRemaining <= 20000 or blue == 0 or red == 0) and timeRemaining >= 19500 then
  51.         local victory=""
  52.         if blue > red then
  53.             victory="Azuis"
  54.             tfm.exec.giveCheese(i)
  55.             tfm.exec.playerVictory(i)
  56.         elseif red > blue then
  57.             victory="Vermelhos"
  58.         elseif red == blue then
  59.             victory="none"
  60.       end  
  61.       for i,v in pairs(tfm.get.room.playerList) do
  62.           if newData[i].Team == victory then
  63.             tfm.exec.giveCheese(i)
  64.             tfm.exec.playerVictory(i)
  65.             newData[i].XP = newData[i].XP + 10
  66.             tfm.exec.chatMessage("Você e seu time venceram a partida",i)
  67.           else
  68.           if v.isDead then
  69.               tfm.exec.respawnPlayer(i)
  70.           end
  71.         end
  72.         if victory == "none" then
  73.           tfm.exec.killPlayer(i)
  74.        end
  75.      end
  76.     partidaTerminou=true
  77.     tfm.exec.newGame(maps[math.random(#maps)])
  78.    end
  79.   if (startTime) then
  80.       if (tempo > 0) then
  81.           tempo = (tempo - 0.5)
  82.             if (not tostring(tempo):find('.5')) then
  83.                 ui.setMapName("<CE>A partida começa em "..(tempo + 1).." segundos.</CE>")
  84.             end
  85.         elseif (not startGame) then
  86.             startTime = false
  87.             startGame = true
  88.           tfm.exec.newGame(maps[math.random(#maps)])
  89.       tfm.exec.setGameTime(99999)
  90.      end
  91.     end
  92.   end
  93. end
  94. ---------------------------------
  95. -- @Quantia de players necessarias para iniciar a partida.
  96. -- @Dar incio ao jogo/ sai do lobby
  97. ---------------------------------
  98. if proom < 2 then
  99.   ui.setMapName("<CE>Precisa de mais jogadores para começar o jogo</CE>")
  100. end
  101.   if (not startGame) then
  102.        if (proom >= 2) then
  103.           tempo = 20
  104.               startTime=true
  105.         end
  106.     end  
  107. ---------------------------------
  108. -- @ Novo jogo
  109. ---------------------------------      
  110. function eventNewGame()
  111.   blue = 0
  112.   red = 0
  113.     teamtime = math.random(0,1)
  114.     for p,n in pairs(tfm.get.room.playerList) do
  115.       if teamtime == 0 then
  116.           newData[p].Team = "Vermelhos"
  117.           tfm.exec.chatMessage("Você está no time Os Vermelhos",p)
  118.           teamtime=1
  119.           blue=blue+1
  120.       else
  121.           newData[p].Team = "Azuis"
  122.           tfm.exec.chatMessage("Você está no time Os Azuis",p)
  123.           newData[p].Life = 3
  124.           teamtime=0
  125.           red=red+1
  126.     end
  127.     LifePlayer(p)
  128.   end
  129. end
  130. ---------------------------------
  131. -- @ poder
  132. ---------------------------------  
  133. if k == 32 and tfm.get.room.playerList[p].isFacingRight == true and info[p].time < os.time()-1500 then
  134.             info[p].time = os.time()
  135.             tfm.exec.movePlayer(p,0,0,true,100,0,false)
  136.         elseif k == 32 and tfm.get.room.playerList[p].isFacingRight == false and info[p].time < os.time()-1500 then
  137.             info[p].time = os.time()
  138.             tfm.exec.movePlayer(p,0,0,true,-100,0,false)
  139.         end
  140.  local facingLeft = {}
  141.  
  142. for name in pairs(tfm.get.room.playerList) do
  143. for _,key in pairs{0,2,3} do system.bindKeyboard(name, key, true)
  144.     end
  145. end
  146.  
  147.     function eventKeyboard(name, key, down, x, y)
  148.         if key == 0 or key == 2 then
  149.         facingLeft[name] = key == 0
  150.         elseif key == 3 then
  151.         if facingLeft[name] then
  152.          tfm.exec.addShamanObject(34, x - 8, y - 5, 0, 20)
  153. else
  154.          tfm.exec.addShamanObject(34, x + 8, y - 5, 0, 20)
  155.         end
  156.     end
  157. end
  158. ---------------------------------
  159. -- @Função levelup.
  160. ---------------------------------
  161. function levelUP(name,xp)
  162.   newData[name].XP = newData[name].xp + 10
  163.   if newData[name].XP >= 100 then
  164.       newData[name].Level = newData[name].Level + 1
  165.       newData[name].XP = 0
  166.       tfm.exec.chatMessage("Você subiu mais um nível!",name)
  167.     end
  168. end
  169. ---------------------------------
  170. -- @Função Vida.
  171. ---------------------------------
  172. function LifePlayer(name)
  173.   if newData[name].Life == 2 then
  174.       color = "#23a62a"
  175.     elseif newData[name].Life == 1 then
  176.       color = "#8c278c"
  177.     elseif newData[name].Life == 0 then
  178.       color = "#b09d30"
  179.     ui.addTextArea(51, "<font size='40' color='"..color.."'>❤</font><font size='26'><B>x"..newData[name].Life.."</B>", name, 16, 344, 100, 100, 0xde0707, 0x000000, 0, true)
  180.   end
  181. end
  182. ---------------------------------
  183. -- @Jogador morre
  184. ---------------------------------
  185. function eventPlayerDied(name)
  186.   if newData[name].Life > 0 then
  187.       tfm.exec.respawnPlayer(name)
  188.       newData[name].Life = newData[name].Life - 1
  189.       LifePlayer(name)
  190.   end
  191.   if newData[name].Life <= 0 then
  192.       tfm.exec.killPlayer(name)
  193.       tfm.exec.chatMessage("<B>Todas as tuas vidas acabaram.</B>:(", name)
  194.   end
  195. end  
  196. ---------------------------------
  197. -- @Função jogador sai da sala.
  198. ---------------------------------
  199. function eventPlayerLeft(name)
  200.     p=p-1
  201.     if p < 2 then
  202.         tfm.exec.newGame("#1")
  203.             startGame = false
  204.             startTime = false
  205.   end
  206. end    
  207. -----------------------------
  208. --@ Outras coisas
  209. -----------------------------    
  210. end
  211. tfm.exec.newGame('<C><P L="1600" /><Z><S><S P="0,0,0.3,0.2,0,0,0,0" L="1545" o="ff8900" X="801" c="4" Y="68" T="12" H="85" /><S H="85" L="1545" o="df7800" X="800" c="4" Y="153" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S H="85" L="1545" o="9b5300" X="802" c="4" Y="322" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="1545" o="c26801" X="799" c="4" Y="237" T="12" H="85" /><S P="0,0,0,0.2,0,0,0,0" L="30" o="ffd700" X="16" Y="198" T="12" H="402" /><S L="30" o="ffcb00" X="1585" H="402" Y="200" T="12" P="0,0,0,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="1600" o="ffcb00" X="800" Y="383" T="12" H="40" /><S L="1600" o="ffcb00" X="799" H="30" Y="12" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="21" o="ffcb00" X="802" Y="196" T="12" H="339" /></S><D /><O /></Z></C>')
  212. tfm.exec.setGameTime(9999999999)
  213. table.foreach(tfm.get.room.playerList, eventNewPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement