Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- admin = "Vanepatrona"
- teamPlayers = {
- {"Vanepatrona", "", "", "", ""};
- {"", "", "", "", "", ""};
- }
- goalScore = 2
- maps = {203664,375455,394132,170514,173816,171776,199210,562897,172951,171148,166430,169076,330933,179488,172621,168754,159145,163596,152733,410040,158909,261814,195453,281985,191205,159932,2176211,586901,285589,257324,236768,303151,270924,1324259,1225867,563436,424604,523270,172547,2693587,168204,2693344,193662,1788490,305680,149451,176253,342035,2466489,292808,176615,438333,394125,162482,304861,458528,159298,184648,268915,329318,373105,261298,302080,449496,159187,176710,161023,366260,1852910,201172,549759,257715,397478,261298,177652,408643,447805,155606,176619,460961,455271,172512,320607,166271,299942,186066,152260,155628,166805,178297,313138,167903,223947,191177,113156,150664,157203,163159,197229,204647,163531,232675,216173,166361,169059,271411,277824,306365,172520}
- ------------------------------------------------------------
- teamColor = {0xCC0000, 0x0033FF}
- teamScore = {0,0}
- gameStarted = nil
- gameFinished = nil
- currentMap = nil
- playersAlive = nil
- playersInRoom = 0
- players = {}
- team = {}
- first = nil
- teamList = {"",""}
- for i=1,2 do
- for _,name in pairs(teamPlayers[i]) do
- team[name] = i
- teamList[i] = teamList[i] .. name .. "\n"
- end
- end
- function main()
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disablePhysicalConsumables(true)
- for name in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
- tfm.exec.newGame(0)
- local x = {110,690}
- for name,t in pairs(team) do
- tfm.exec.movePlayer(name, x[t], 350)
- end
- tfm.exec.movePlayer(admin, 400, 350)
- ui.addTextArea(1, "<font size='16'>Equipo 1</font>\n\n"..teamList[1], nil, 30, 54, 160, 320, 0x4a4d60, 0x3a3d4b, 0.8, true)
- ui.addTextArea(2, "<font size='16'>Equipo 2</font>\n\n"..teamList[2], nil, 610, 54, 160, 320, 0x4a4d60, 0x3a3d4b, 0.8, true)
- ui.addTextArea(3, "<p align='center'><font size='16'><a href='event:start'> Empezar </a></font></p>", admin, 320, 180, 160, 32, 0x4a4d60, 0x3a3d4b, 1, true)
- end
- function startGame()
- local newMap
- repeat
- newMap = math.random(#maps)
- until newMap ~= currentMap
- currentMap = newMap
- tfm.exec.newGame(maps[newMap])
- end
- function endGame()
- startGame()
- end
- function eventNewGame()
- playersAlive = playersInRoom
- first = false
- for name,t in pairs(team) do
- tfm.exec.setNameColor(name, teamColor[t])
- end
- tfm.exec.setGameTime(300)
- end
- function eventNewPlayer(name)
- if team[name] then
- playersInRoom = playersInRoom + 1
- end
- end
- function eventPlayerLeft(name)
- if team[name] then
- playersInRoom = playersInRoom - 1
- end
- end
- function eventPlayerDied(name)
- if not gameStarted then return end
- if team[name] then
- playersAlive = playersAlive - 1
- checkPlayers()
- end
- end
- function eventPlayerWon(name)
- if not gameStarted then return end
- if team[name] then
- if not first then
- first = true
- local t = team[name]
- teamScore[t] = teamScore[t] + 1
- updateScore()
- tfm.exec.setGameTime(5)
- if teamScore[t] == goalScore then
- gameStarted = false
- gameFinished = true
- local c = {"#F90505","#0045FF"}
- ui.addTextArea(5, "<p align='center'><font size='20' color='" .. c[t] .. "'>¡El equipo " .. t .. " ha ganado!</font></p>", nil, 0, 170, 800, 60, 0, 0, 0, true)
- end
- end
- playersAlive = playersAlive - 1
- checkPlayers()
- end
- end
- function checkPlayers()
- if playersAlive == 0 then
- endGame()
- end
- end
- function eventLoop(t, tr)
- if gameFinished then
- for i=1,8 do
- local x,y = math.random(0,800), math.random(0,400)
- for j=1,5 do
- tfm.exec.displayParticle(math.random(21,24), x, y, math.random(-5,5), 0, 0, math.random(10)/10, nil)
- end
- end
- end
- if not gameStarted then return end
- if tr <= 0 then
- endGame()
- end
- end
- function eventTextAreaCallback(id, name, cb)
- if id == 3 and not gameStarted then
- gameStarted = true
- for i=1,3 do
- ui.removeTextArea(i)
- end
- updateScore()
- startGame()
- end
- end
- function updateScore()
- local t = string.format("<p align='center'><font size='32'><font color='#F90505'>%02d</font> - <font color='#0045FF'>%02d</font></font></p>", teamScore[1], teamScore[2])
- ui.addTextArea(4, t, nil, 320, 20, 160, 43, 0x4a4d60, 0x3a3d4b, 0, true)
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment