Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------------
- -- @Alguns valores de armazenamento e dados.
- -- @Desabilita algumas funções do jogo.
- --@ Auto shaman, Auto new game, Auto time left, Consumiveis, Auto morte, afk morte, Auto score.
- -----------------------------
- for _, v in next, {'AutoShaman', 'AutoNewGame', 'AutoTimeLeft', 'PhysicalConsumables', 'AfkDeath', 'MortCommand', 'AutoScore'} do
- tfm.exec['disable' .. v]()
- end
- -----------------------------
- --@ Algumas variaveis
- -----------------------------
- newData = {}
- deleteObject = {}
- tempo = os.time()
- p = 0
- proom = 0
- blue = 0
- red = 0
- -- @Inicio do jogo
- StartTime=false
- startGame=false
- -----------------------------
- --@ Mapas racing
- -----------------------------
- maps={"@4953687","@5032745","@1979131","@260384","@5650267","@229827","@161730","@3638794","@1856349","@4238784","@4148332","@210188","@1368233 ","@214660","@1525272","@1637638 ","@327130","@556426","@208914"}
- -----------------------------
- --@ Novo jogador
- -----------------------------
- function eventNewPlayer(name)
- proom=proom+1
- newData[name] = {
- Team = "",
- XP = 0,
- Level = 0,
- Life = 3,
- lang = "",
- tempo = os.time(),
- }
- -----------------------------
- -- @System que define quem ganha a partida
- -----------------------------
- function eventLoop(currentTime,timeRemaining)
- for _,obj in ipairs(deleteObject) do
- if obj.time < os.time()-4000 then
- tfm.exec.removeObject(obj.id)
- table.remove(deleteObject,_)
- end
- end
- if (startTime) then
- if (timeRemaining <= 20000 or blue == 0 or red == 0) and timeRemaining >= 19500 then
- local victory=""
- if blue > red then
- victory="Azuis"
- tfm.exec.giveCheese(i)
- tfm.exec.playerVictory(i)
- elseif red > blue then
- victory="Vermelhos"
- elseif red == blue then
- victory="none"
- end
- for i,v in pairs(tfm.get.room.playerList) do
- if newData[i].Team == victory then
- tfm.exec.giveCheese(i)
- tfm.exec.playerVictory(i)
- newData[i].XP = newData[i].XP + 10
- tfm.exec.chatMessage("Você e seu time venceram a partida",i)
- else
- if v.isDead then
- tfm.exec.respawnPlayer(i)
- end
- end
- if victory == "none" then
- tfm.exec.killPlayer(i)
- end
- end
- partidaTerminou=true
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- if (startTime) then
- if (tempo > 0) then
- tempo = (tempo - 0.5)
- if (not tostring(tempo):find('.5')) then
- ui.setMapName("<CE>A partida começa em "..(tempo + 1).." segundos.</CE>")
- end
- elseif (not startGame) then
- startTime = false
- startGame = true
- tfm.exec.newGame(maps[math.random(#maps)])
- tfm.exec.setGameTime(99999)
- end
- end
- end
- end
- ---------------------------------
- -- @Quantia de players necessarias para iniciar a partida.
- -- @Dar incio ao jogo/ sai do lobby
- ---------------------------------
- if proom < 2 then
- ui.setMapName("<CE>Precisa de mais jogadores para começar o jogo</CE>")
- end
- if (not startGame) then
- if (proom >= 2) then
- tempo = 20
- startTime=true
- end
- end
- ---------------------------------
- -- @ Novo jogo
- ---------------------------------
- function eventNewGame()
- blue = 0
- red = 0
- teamtime = math.random(0,1)
- for p,n in pairs(tfm.get.room.playerList) do
- if teamtime == 0 then
- newData[p].Team = "Vermelhos"
- tfm.exec.chatMessage("Você está no time Os Vermelhos",p)
- teamtime=1
- blue=blue+1
- else
- newData[p].Team = "Azuis"
- tfm.exec.chatMessage("Você está no time Os Azuis",p)
- newData[p].Life = 3
- teamtime=0
- red=red+1
- end
- LifePlayer(p)
- end
- end
- ---------------------------------
- -- @ poder
- ---------------------------------
- if k == 32 and tfm.get.room.playerList[p].isFacingRight == true and info[p].time < os.time()-1500 then
- info[p].time = os.time()
- tfm.exec.movePlayer(p,0,0,true,100,0,false)
- elseif k == 32 and tfm.get.room.playerList[p].isFacingRight == false and info[p].time < os.time()-1500 then
- info[p].time = os.time()
- tfm.exec.movePlayer(p,0,0,true,-100,0,false)
- end
- local facingLeft = {}
- for name in pairs(tfm.get.room.playerList) do
- for _,key in pairs{0,2,3} do system.bindKeyboard(name, key, true)
- end
- end
- function eventKeyboard(name, key, down, x, y)
- if key == 0 or key == 2 then
- facingLeft[name] = key == 0
- elseif key == 3 then
- if facingLeft[name] then
- tfm.exec.addShamanObject(34, x - 8, y - 5, 0, 20)
- else
- tfm.exec.addShamanObject(34, x + 8, y - 5, 0, 20)
- end
- end
- end
- ---------------------------------
- -- @Função levelup.
- ---------------------------------
- function levelUP(name,xp)
- newData[name].XP = newData[name].xp + 10
- if newData[name].XP >= 100 then
- newData[name].Level = newData[name].Level + 1
- newData[name].XP = 0
- tfm.exec.chatMessage("Você subiu mais um nível!",name)
- end
- end
- ---------------------------------
- -- @Função Vida.
- ---------------------------------
- function LifePlayer(name)
- if newData[name].Life == 2 then
- color = "#23a62a"
- elseif newData[name].Life == 1 then
- color = "#8c278c"
- elseif newData[name].Life == 0 then
- color = "#b09d30"
- 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)
- end
- end
- ---------------------------------
- -- @Jogador morre
- ---------------------------------
- function eventPlayerDied(name)
- if newData[name].Life > 0 then
- tfm.exec.respawnPlayer(name)
- newData[name].Life = newData[name].Life - 1
- LifePlayer(name)
- end
- if newData[name].Life <= 0 then
- tfm.exec.killPlayer(name)
- tfm.exec.chatMessage("<B>Todas as tuas vidas acabaram.</B>:(", name)
- end
- end
- ---------------------------------
- -- @Função jogador sai da sala.
- ---------------------------------
- function eventPlayerLeft(name)
- p=p-1
- if p < 2 then
- tfm.exec.newGame("#1")
- startGame = false
- startTime = false
- end
- end
- -----------------------------
- --@ Outras coisas
- -----------------------------
- end
- 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>')
- tfm.exec.setGameTime(9999999999)
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement