Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.newGame('@7123013', nil)
- blueGoal = ""
- blueFall = ""
- redGoal = ""
- redFall = ""
- bluePoint = 0
- redPoint = 0
- ball = ""
- team = "B"
- teams = {}
- function expertMove(j)
- if teams[j] == "B" then
- tfm.exec.movePlayer(j, math.random(10,800), 360, false, 0, 0, false)
- elseif teams[j] == "R" then
- tfm.exec.movePlayer(j, math.random(800,1590), 360, false, 0, 0, false)
- else
- end
- end
- function eventNewPlayer(j)
- ui.addTextArea(1, '<p align="center">' .. bluePoint .. '</p>', j, 350, 20, 20, 20, 0x123450, 0x0000ff, 1, true)
- ui.addTextArea(2, '<p align="center">' .. redPoint .. '</p>', j, 450, 20, 20, 20, 0x123450, 0xff0000, 1, true)
- end
- function start()
- bluePoint = 0
- redPoint = 0
- for i, v in pairs(tfm.get.room.playerList) do
- eventNewPlayer(i)
- tfm.exec.respawnPlayer(i)
- if team == "B" then
- teams[i] = "B"
- team = "R"
- tfm.exec.setNameColor(i, 0x0000ff)
- expertMove(i)
- elseif team == "R" then
- teams[i] = "R"
- team = "B"
- tfm.exec.setNameColor(i, 0xff0000)
- expertMove(i)
- end
- end
- end
- eventNewGame = function()
- pisos = {} -- Limpa a tabela
- local xml = tfm.get.room.xmlMapInfo.xml
- local tagPisos = xml:match("<S>(.*)</S>") or "" -- Coleta todas as tag <S do script
- for piso in tagPisos:gmatch("<S (.-)/>") do
- local atributos = {}
- for atributo,_,valor in piso:gmatch("(%w+) ?= ?([\"'])(.-)%2") do
- atributos[atributo] = valor
- end
- pisos[#pisos + 1] = atributos
- end
- for i, v in pairs(pisos) do
- for n, g in pairs(v) do
- if n == "lua" then
- if g == "1" then
- blueGoal = v
- end
- if g == "2" then
- blueFall = v
- end
- if g == "3" then
- redGoal = v
- end
- if g == "4" then
- redFall = v
- end
- end
- end
- end
- start()
- ball = tfm.exec.addShamanObject(604, 800, 200, 0, 0, -10, false)
- end
- function eventLoop(p, r)
- if p > 100 then
- excedent = nil
- for i, v in pairs(tfm.get.room.objectList) do
- if not(i == ball) then
- excedent = i
- print("BUG: discovered more than one ball in game, removing excedent")
- end
- end
- if not(excedent == nil) then
- tfm.exec.removeObject(excedent)
- end
- if not(ball == "") then
- if tfm.get.room.objectList[ball].x < blueGoal.X + (blueGoal.L/2) and tfm.get.room.objectList[ball].x > blueGoal.X - (blueGoal.L/2) and tfm.get.room.objectList[ball].y > blueGoal.Y - (blueGoal.H/2) and tfm.get.room.objectList[ball].y < blueGoal.Y + (blueGoal.H/2) then
- redPoint = redPoint + 1
- tfm.exec.removeObject(ball)
- ui.updateTextArea(2, '<p align="center">' .. redPoint .. '</p>', nil)
- for i, v in pairs(tfm.get.room.playerList) do
- expertMove(i)
- if teams[i] == "B" then
- tfm.exec.playEmote(i,2, nil)
- elseif teams[i] == "R" then
- tfm.exec.playEmote(i,9, nil)
- end
- end
- ball = tfm.exec.addShamanObject(604, 800, 200, 0, -1, -10, false)
- end
- if tfm.get.room.objectList[ball].x < redGoal.X + (redGoal.L/2) and tfm.get.room.objectList[ball].x > redGoal.X - (redGoal.L/2) and tfm.get.room.objectList[ball].y > redGoal.Y - (redGoal.H/2) and tfm.get.room.objectList[ball].y < redGoal.Y + (redGoal.H/2) then
- bluePoint = bluePoint + 1
- tfm.exec.removeObject(ball)
- ui.updateTextArea(1, '<p align="center">' .. bluePoint .. '</p>', nil)
- for i, v in pairs(tfm.get.room.playerList) do
- expertMove(i)
- if teams[i] == "R" then
- tfm.exec.playEmote(i,2, nil)
- elseif teams[i] == "B" then
- tfm.exec.playEmote(i,9, nil)
- end
- end
- ball = tfm.exec.addShamanObject(604, 800, 200, 0, 1, -10, false)
- end
- end
- if tfm.get.room.objectList[ball].x < blueFall.X + (blueFall.L/2) and tfm.get.room.objectList[ball].x > blueFall.X - (blueFall.L/2) and tfm.get.room.objectList[ball].y > blueFall.Y - (blueFall.H/2) and tfm.get.room.objectList[ball].y < blueFall.Y + (blueFall.H/2) then
- tfm.exec.removeObject(ball)
- for i, v in pairs(tfm.get.room.playerList) do
- expertMove(i)
- if teams[i] == "R" then
- tfm.exec.playEmote(i,4, nil)
- end
- ball = tfm.exec.addShamanObject(604, 800, 200, 0, 0, -10, false)
- end
- end
- if tfm.get.room.objectList[ball].x < redFall.X + (redFall.L/2) and tfm.get.room.objectList[ball].x > redFall.X - (redFall.L/2) and tfm.get.room.objectList[ball].y > redFall.Y - (redFall.H/2) and tfm.get.room.objectList[ball].y < redFall.Y + (redFall.H/2) then
- tfm.exec.removeObject(ball)
- for i, v in pairs(tfm.get.room.playerList) do
- expertMove(i)
- if teams[i] == "B" then
- tfm.exec.playEmote(i,4, nil)
- end
- ball = tfm.exec.addShamanObject(604, 800, 200, 0, 0, -10, false)
- end
- end
- if bluePoint > 4 then
- start()
- end
- if redPoint > 4 then
- start()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement