Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- TODO:
- -- checkpoints, score arriba grafico, arriba poner puntos, establecer score con los puntos, arreglar autoJoin
- 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("text", true)
- autoJoin = "on"
- enJuego = false
- contTeam1 = 0
- contTeam2 = 0
- verTexto = true
- tiempoJugado = 0
- puntosParaGanar = 5
- scoreTeams = 3
- args = {}
- jugador = false
- active = true
- 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 remainingTime <= 2823 then
- newMap()
- end
- end
- function eventPlayerLeft (playerName)
- if enJuego == false then
- for i=1, #teams.Team1 do
- if playerName == teams.Team1[i] then
- teams.Team1[i] = "[Player Left]"
- textoArea()
- end
- end
- for i=1, #teams.Team2 do
- if playerName == teams.Team2[i] then
- teams.Team2[i] = "[Player Left]"
- textoArea()
- end
- end
- end
- end
- function eventNewPlayer (playerName)
- if autoJoin == "on" then
- if enJuego then
- if #teams.Team1 > #teams.Team2 then
- table.insert(teams.Team1,playerName)
- else
- table.insert(teams.Team2,playerName)
- end
- tfm.exec.respawnPlayer(playerName)
- establecerColor()
- end
- end
- if enJuego == false then
- textoArea()
- end
- end
- function newMap()
- active = false
- enJuego = true
- contTeam1 = 0
- contTeam2 = 0
- local mapcode = maps[math.random(#maps)]
- tfm.exec.newGame(mapcode)
- for name, p in pairs(tfm.get.room.playerList) do
- if not matarNoJugadores(name) then
- tfm.exec.killPlayer(name)
- end
- end
- establecerColor()
- establecerTiempo()
- end
- function eventChatCommand(playerName, command)
- if playerName == adm then
- args = string.split(command, " ")
- if args[1] == "skip" or args[1] == "saltar" and enJuego then
- newMap()
- end
- if args[1] == "text" and enJuego == false then
- print(enJuego)
- print(verTexto)
- if verTexto then
- verTexto = false
- else
- verTexto = true
- end
- end
- if args[1] == "d" then
- if tonumber(args[2]) ~= nil then
- puntosParaGanar = tonumber(args[2])
- end
- end
- if args[1] == "pointsteam" or args[1] == "pointsteams" or args[1] == "pointeams" or args[1] == "pt" then
- if tonumber(args[2]) ~= nil then
- scoreTeams = tonumber(args[2])
- end
- end
- if args[1] == "add" then -- si el comando es add
- if args[2] == "team1" then -- y sigue con team1
- for i=3, #args do -- recorre toda la tabla args
- for j=1, #teams.Team2 do -- recorre toda la tabla teams2
- if args[i] == teams.Team2[j] then -- si un elemento de la tabla args conicide con un elento de la tabla teams2
- teams.Team2[j] = "[Removed]" -- reemplaza su nombre por removed
- end
- end
- end
- end
- teams.Team1 = {} -- establece vacio la tabla teams1
- for i=3, #args do
- table.insert (teams.Team1, args[i]) -- le aƱade a team1 los argumentos escritos.
- establecerPuntos()
- end
- if args[2] == "team2" then
- for i=3, #args do -- recorre toda la tabla args
- for j=1, #teams.Team1 do -- recorre toda la tabla teams1
- if args[i] == teams.Team1[j] then -- si un elemento de la tabla args conicide con un elento de la tabla teams1
- teams.Team1[j] = "[Removed]" -- reemplaza su nombre por removed
- end
- end
- end
- teams.Team2 = {}
- for i=3, #args do
- table.insert (teams.Team2, args[i])
- establecerPuntos()
- end
- end
- end
- if args[1] == "autoj" or args[1] == "aj" then
- autoj()
- end
- end
- textoArea()
- end
- function establecerTiempo()
- tfm.exec.setGameTime(1080)
- end
- function establecerTiempoGanar()
- tfm.exec.setGameTime(10)
- end
- function eventTextAreaCallback(id, player, callback)
- if callback == 'iniciarJuego' and tiempoJugado >= 3383 then
- tfm.exec.disableAutoNewGame(true)
- verTexto = false
- newMap()
- end
- if callback == 'llenarEquipos' then
- establecerPuntos()
- establecerEquipos()
- end
- if callback == 'vaciar' then
- teams.Team1 = {}
- teams.Team2 = {}
- end
- if callback == 'autoj' then
- autoj()
- end
- textoArea()
- end
- function autoj()
- if autoJoin == "on" then
- autoJoin = "off"
- else
- autoJoin = "on"
- end
- end
- function eventPlayerDied (playerName)
- if enJuego == false or matarNoJugadores(playerName) == true then
- tfm.exec.respawnPlayer(playerName)
- establecerColor()
- end
- end
- function matarNoJugadores(name)
- player = name
- for i = 1, #teams.Team1 do
- if teams.Team1[i] == player then
- return true
- end
- end
- for i = 1, #teams.Team2 do
- if teams.Team2[i] == player then
- return true
- end
- end
- return false
- 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 equipo = 1
- for k in pairs(tfm.get.room.playerList) do
- if equipo == 1 then
- table.insert(teams.Team1, k)
- equipo = 2
- elseif equipo == 2 then
- table.insert(teams.Team2, k)
- equipo = 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)
- active = true
- tfm.exec.respawnPlayer(playerName)
- establecerColor()
- system.bindMouse(playerName, active)
- system.bindKeyboard(playerName, 32, active)
- for i, v in pairs(teams.Team1) do
- if playerName == v then
- contTeam1 = contTeam1 +1
- tfm.exec.setPlayerScore(playerName, 1)
- end
- end
- for i,v in pairs (teams.Team2) do
- if playerName == v then
- contTeam2 = contTeam2 +1
- end
- end
- equipoPunto()
- end
- function eventKeyboard(name, key, down, px, py)
- _space = 32
- if active then
- if key == _space then
- tfm.exec.movePlayer(name, 0, 0, true, 0, -40, true)
- end
- end
- end
- function eventMouse(name, mx, my)
- if active then
- tfm.exec.movePlayer(name, mx, my)
- end
- end
- function equipoPunto()
- if enJuego then
- if contTeam1 == scoreTeams then
- puntos.team1Puntos = puntos.team1Puntos + 1
- contTeam1 = 0
- contTeam2 = 0
- enJuego = false
- establecerTiempoGanar()
- end
- if contTeam2 == scoreTeams then
- puntos.team2Puntos = puntos.team2Puntos + 1
- contTeam1 = 0
- contTeam2 = 0
- enJuego = false
- establecerTiempoGanar()
- end
- end
- if puntos.team1Puntos >= puntosParaGanar then
- team1Gano = true
- ganador()
- end
- if puntos.team2Puntos >= puntosParaGanar then
- ganador()
- end
- end
- function ganador()
- tfm.exec.newGame(7589151)
- establecerColor()
- 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='#00C17C'><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='#F93018'><b>Iniciar", adm, 375, 60, 0, 0, 0x324650, 0x121212, 1, true)
- ui.addTextArea(8, "<p align='center'>ScoreT: <font color='#00C17C'><b>" ..(scoreTeams), nil, 225, 36, 70, 20, 0x324650, 0x121212, 1, true)
- ui.addTextArea(9, "<p align='center'><V><a href='event:llenarEquipos'><font color='#F93018'><b>Llenar", adm, 240, 60, 0, 0, 0x324650, 0x121212, 1, true)
- ui.addTextArea(10, "<p align='center'>Score: <font color='#00C17C'><b>" ..(puntosParaGanar), nil, 500, 36, 70, 20, 0x324650, 0x121212, 1, true)
- ui.addTextArea(11, "<p align='center'><V><a href='event:vaciar'><font color='#F93018'><b>Vaciar", adm, 515, 60, 0, 0, 0x324650, 0x121212, 1, true)
- ui.addTextArea(12, "<p align='center'>Auto Join: <V><a href='event:autoj'><font color='#F93018'><b>" .. (autoJoin), adm, 660, 342, 0, 0, 0x324650, 0x121212, 1, true)
- establecerColor()
- else
- for i=0, 17,1 do
- ui.removeTextArea(i)
- end
- end
- end
- --[[function string.split(s, pattern, n)
- local st = {}
- for sb in string.gmatch(s, "[^"..pattern.."]+") do
- if not n or n > -1 then
- table.insert(st,sb)
- else
- st[#st] = st[#st]..pattern..sb
- end
- n = n and n-1 or false
- end
- return st
- end --]]
- establecerTiempo()
- textoArea()
- establecerPuntos()
- --[[function matarNoJugadores(name)
- local player = name
- for i,v in pairs(teams.Team1) do
- if v == player then
- return true
- end
- end
- for i,n in pairs(teams.Team2) do
- if n == player then
- return true
- end
- end
- return false
- end ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement