Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- TODO:
- -- sistema admin, graficos, checkpoints, terminar que cambie el mapa cuando ganen, score arriba grafico
- adm="Blood#3565"
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoTimeLeft()
- tfm.exec.disablePhysicalConsumables()
- tfm.exec.disableAutoScore()
- tfm.exec.disableMinimalistMode()
- tfm.exec.newGame(7657121)
- tfm.exec.disableAutoNewGame(false)
- system.disableChatCommandDisplay("mapa", true)
- system.disableChatCommandDisplay("texto", true)
- enJuego = false
- contTeam1 = 0
- contTeam2 = 0
- verTexto = true
- tiempoJugado = 0
- puntosParaGanar = 5
- local gameRunning = false
- local teams = {Team1 = {}, Team2 = {}}
- local puntos = {team1Puntos = 0, team2Puntos = 0}
- local maps = {7623375, 7618265, 7598750, 7572953, 7569215, 7565716, 7569454, 7571727, 7568533, 7566172, 7570693, 7197833, 7573427, 7142793, 7565563, 7571737, 7568384, 7566459, 7571491, 7568359, 7568830, 7171137, 7356802, 7506432, 4612890, 7172091, 7565705, 7196916, 7367964}
- function eventLoop (elapsedTime, remainingTime )
- tiempoJugado = elapsedTime
- if enJuego then
- if remainingTime <= 2823 then
- newMap()
- end
- else
- tfm.exec.disableAutoNewGame(true)
- end
- end
- function newMap()
- contTeam1 = 0
- contTeam2 = 0
- local mapcode = maps[math.random(#maps)]
- tfm.exec.newGame(mapcode)
- establecerColor()
- establecerTiempo()
- end
- function eventChatCommand(playerName, command, puntos)
- if playerName == adm then
- if command == "mapa" and enJuego then
- newMap()
- end
- if command == "texto" then
- if verTexto then
- verTexto = false
- else
- verTexto = true
- end
- textoArea()
- end
- if command == "puntos" then
- puntosParaGanar = puntos
- print(puntosParaGanar)
- end
- end
- end
- function establecerTiempo()
- tfm.exec.setGameTime(1080)
- end
- function establecerTiempoGanar()
- tfm.exec.setGameTime(5)
- end
- function eventTextAreaCallback(id, player, callback)
- if callback == 'iniciarJuego' and tiempoJugado >= 3683 then
- enJuego = true
- for i=0, 17,1 do
- ui.removeTextArea(i)
- end
- newMap()
- establecerTiempo()
- enJuego = true
- end
- if callback == 'llenarEquipos' then
- establecerPuntos()
- establecerEquipos()
- textoArea()
- end
- end
- function eventPlayerDied (playerName)
- tfm.exec.respawnPlayer(playerName)
- establecerColor()
- end
- -- borrar?
- function jugadores()
- jugadoresEnSala = 0
- for name in pairs(tfm.get.room.playerList) do
- jugadoresEnSala = jugadoresEnSala +1
- end
- function eventPlayerLeft()
- jugadoresEnSala = jugadoresEnSala -1
- end
- end
- ----------------
- function establecerPuntos()
- for name in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore(name, 0)
- end
- end
- function establecerEquipos()
- teams.Team1 = {}
- teams.Team2 = {}
- local t = 1
- for k in pairs(tfm.get.room.playerList) do
- if t == 1 then
- table.insert(teams.Team1, k)
- t = 2
- elseif t == 2 then
- table.insert(teams.Team2, k)
- t = 1
- end
- end
- end
- function establecerColor()
- for i, v in pairs(teams.Team1) do
- tfm.exec.setNameColor(v, 0xE2FF14)
- end
- for i, v in pairs(teams.Team2) do
- tfm.exec.setNameColor(v, 0x2F7FCC)
- end
- end
- function eventPlayerWon ( playerName, timeElapsed, timeElapsedSinceRespawn )
- for i, v in pairs(teams.Team1) do
- if playerName == v then
- contTeam1 = contTeam1 +1
- print(contTeam1)
- end
- end
- for i,v in pairs (teams.Team2) do
- if playerName == v then
- contTeam2 = contTeam2 +1
- print(contTeam2)
- end
- end
- equipoPunto()
- end
- function equipoPunto()
- if contTeam1 == 3 then
- puntos.team1Puntos = puntos.team1Puntos + 1
- contTeam1 = 0
- contTeam2 = 0
- establecerTiempoGanar()
- end
- if contTeam2 == 3 then
- puntos.team1Puntos = puntos.team2Puntos + 1
- contTeam1 = 0
- contTeam2 = 0
- establecerTiempoGanar()
- end
- if puntos.team1Puntos >= puntosParaGanar then
- team1Gano = true
- ganador()
- end
- if puntos.team2Puntos >= puntosParaGanar then
- ganador()
- end
- end
- function ganador()
- tfm.exec.newGame(7589151)
- if team1Gano then
- print ("equp1")
- else
- print ("equp2")
- end
- end
- -- GRAFICO --
- function textoArea()
- if verTexto then
- ui.addTextArea(0, "", nil, 200, 62, 400, 12, 0x324650, 0x121212, 0.7, true)
- ui.addTextArea(1, "", nil, 200, 44, 400, 12, 0x324650, 0x121212, 1, true)
- ui.addTextArea(2, "<p align='center'><font color='#00ff40'><b>" ..(adm), nil, 320, 36, 150, 20, 0x324650, 0x121212, 1, true)
- ui.addTextArea(3, "<p align='center'><font color='#E2FF14'>" .. (table.concat(teams.Team1,"\n") or ""), nil, 15, 72, 180, 266, 0x324650, 0x121212, 1, true)
- ui.addTextArea(4, "<p align='center'><font color='#2F7FCC'>" .. (table.concat(teams.Team2,"\n") or ""), nil, 605, 72, 180, 266, 0x324650, 0x121212, 1, true)
- ui.addTextArea(5, "<p align='center'><font color='#E2FF14'><b>Team 1", nil, 10, 44, 190, 20, 0x324650, 0x121212, 1, true)
- ui.addTextArea(6, "<p align='center'><font color='#2F7FCC'><b>Team 2", nil, 600, 44, 190, 20, 0x324650, 0x121212, 1, true)
- ui.addTextArea(7, "<p align='center'><V><a href='event:iniciarJuego'><font color='#CA2411'><b>Iniciar", adm, 375, 60, 0, 0, 0x324650, 0x121212, 1, true)
- ui.addTextArea(8, "<p align='center'><V><a href='event:llenarEquipos'><font color='#CA2411'><b>Llenar", adm, 240, 50, 0, 0, 0x324650, 0x121212, 1, true)
- else
- for i=0, 17,1 do
- ui.removeTextArea(i)
- end
- end
- end
- establecerTiempo()
- textoArea()
- establecerPuntos()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement