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 = {} -- Armazena algums dados importantes do jogo.
- deleteObject = {} -- Para deletar objetos shamam após determinado tempo.
- tempo = os.time() -- Para ausilio do time.
- p = 0 -- Jogadores na sala.
- proom = 0 -- ↑
- -- @Inicio do jogo
- StartTime=false -- Iniciar o tempo.
- startGame=false -- Iniciar o jogo.
- -----------------------------
- --@ Evento acontece quando um jogador entra na sala.
- -----------------------------
- function eventNewPlayer(name)
- proom=proom+1
- newData[name] = {
- Team = "",
- XP = 0,
- Level = 0,
- Life = 3,
- lang = "",
- Apple = 0,
- tempo = os.time(),
- ingredients = 0,
- bonus = 0,
- }
- TextAreaApple(name)
- ---------------------------------
- -- @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>")
- lobby()
- end
- if (not startGame) then
- if (proom >= 1) then
- tempo = 20
- StartTime=true
- end
- end
- -----------------------------
- -- @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 (startGame) then
- tfm.exec.addShamanObject(39, math.random(7, 697),0,0,0,true)
- tfm.exec.addShamanObject(39, math.random(4, 700),0,0,0,true)
- end
- if timeRemaining <= 15000 then
- if newData[name].Apple > 3 then
- tfm.exec.giveCheese(name)
- tfm.exec.playerVictory(name)
- newData[name].Apple = 0
- newData[name].bonus = newData[name].bonus + 10
- newData[name].ingredients = newData[name].ingredients + newData[name].Apple
- lobby()
- else
- tfm.exec.killPlayer(name)
- newData[name].bonus = newData[name].bonus + 5
- newData[name].ingredients = newData[name].ingredients + newData[name].Apple
- end
- 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
- round()
- tfm.exec.setGameTime(100)
- end
- end
- end
- end -- End do eventNew player.
- ---------------------------------
- -- @ Evento acontece quando um novo jogo começa.
- ---------------------------------
- function eventNewGame()
- for p,n in pairs(tfm.get.room.playerList) do
- keyEvent(p)
- newData[p].Apple = 0
- tfm.exec.setPlayerScore(p,newData[p].Apple)
- TextAreaApple(p)
- end
- end
- ---------------------------------
- -- @ TextArea das maçãs coletadas.
- ---------------------------------
- function TextAreaApple(name)
- ui.addTextArea(0, "<font size='25'><B><VP>"..newData[name].Apple.."</font>", name, 40, 363, 97, 30, 0x324650, 0x000000, 0, true)
- end
- ---------------------------------
- -- @ Mapa.
- ---------------------------------
- function round()
- tabela={"x_transformice/x_evt/x_evt_15/ngzldsop/map-paques-fond.jpg","x_transformice/x_evt/x_evt_01/kjneb75/map-nouvel-an.jpg","x_transformice/x_evt/rs4otmym/epiphanie.jpg","x_transformice/x_evt/x_evt_05/yelfrdge/fond.jpg","x_transformice/x_evt/x_evt_08/zenlksgd/fond.jpg"}
- tfm.exec.newGame('<C><P d="x_chamane/i_003.png,5,363" D="'..tabela[math.random(#tabela)]..'"/><Z><S><S X="401" L="798" Y="408" c="3" H="18" P="0,0,0.3,0.2,0,0,0,0" T="0" /></S><D /><O /></Z></C>')
- end
- ---------------------------------
- -- @ Evento do teclado
- ---------------------------------
- function keyEvent(p)
- 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,32} do
- system.bindKeyboard(name, key, true)
- end
- end
- end
- function eventKeyboard(name, key, down, x, y)
- if key == 32 then
- for n,objectList in pairs(tfm.get.room.objectList) do
- if name ~= n and x >= objectList.x - 23 and x <= objectList.x + 23 and y >= objectList.y - 21 and y <= objectList.y + 21 then
- newData[name].Apple = newData[name].Apple + 1
- tfm.exec.removeObject(39)
- tfm.exec.removeObject(39)
- tfm.exec.setPlayerScore(name,newData[name].Apple)
- ui.addTextArea(0, "<font size='25'><B><VP>"..newData[name].Apple.."</font>", name, 40, 363, 97, 30, 0x324650, 0x000000, 0, true)
- tfm.exec.displayParticle(5,x,y,-0.2,-0.2,0,0)
- break
- end
- end
- end
- end -- End do KeyEvent
- ---------------------------------
- -- @Função jogador sai da sala.
- ---------------------------------
- function eventPlayerLeft(name)
- p=p-1
- if p < 2 then
- startGame = false
- StartTime = false
- end
- end
- -----------------------------
- --@ Outras coisas
- -----------------------------
- function lobby()
- 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)
- startGame = false
- StartTime = false
- end
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement