Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- __ __ __ ___ __ _ __ __ ____
- / / / / / / / _ | / / | | / / _/_/ / __/
- / /__/ /_/ / / __ | / / | |/ / _/_/ _\ \
- /____/\____/ /_/ |_| / / |___/ /_/ /___/
- /_/
- _____ _ _ _ _
- |_ _| | || | | | | |
- | | _ __ ___ | || | ___ __ _ _ __ __| | ___ | | ___
- | | | '__| / _ \ | || | / _ \ / _` || '_ \ / _` | / _ \ | | / _ \
- | | | | | (_) || || || __/| (_| || | | || (_| || (_) || || (_) |
- \_/ |_| \___/ |_||_| \___| \__,_||_| |_| \__,_| \___/ |_| \___/
- V4.9
- -----------------------------------------------------------------------------------]]
- local ADMINISTRADOR = "Hurley#8256" -- Cambia tu nombre para ser administrador
- -----------------------------------------------------------------------------------]]
- --[[
- Comandos:
- !saltar - Para cambiar de mapa
- !puntos - Para cambiar el puntaje, ej: !puntos team1 5
- !np @codigo - Para poner cualquier mapa
- !pausa - Para pausar el juego
- !team - Para asignar jugadores a un equipo, ej: !team1 Trolleandolo
- !d NUMERO - Asigna el puntaje para ganar, ej: !d 20
- !añadir team nick - Añade un jugador a el equipo especificado, ej: !añadir team4 Trolleandolo
- !reset - Resetea el juego
- !quitar NOMBRE - saca a un jugador del juego
- !puntaje - para ver el puntaje [SOLO EN MODO DEATHMATCH]
- --------------------------------------------------------------------
- ]]
- -----------------------------------------------------------------------------------
- local WINS = 15 -- Puntaje para ganar.
- ------------------------------------------------------------------------------------
- --[[
- MEJORAS DE LA VERSIÓN
- [BOTÓN REVANCHA EN DEATHMATCH Y TEAMS]
- [SE QUITÓ UN BUG]
- [SE AÑADIERON MAPAS DE BOOTCAMP]
- [SE REDUJERON LAS PROBABILIDADES DE BUG]
- [SE AÑADIÓ MODO 2 TEAMS AL AZAR]
- ]]
- system.disableChatCommandDisplay("np", true)
- system.disableChatCommandDisplay("pause", true)
- system.disableChatCommandDisplay("saltar", true)
- system.disableChatCommandDisplay("puntaje", true)
- tfm.exec.disablePhysicalConsumables()
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableAutoTimeLeft()
- local teams = {
- [1] = {},
- [2] = {},
- [3] = {},
- [4] = {},
- }
- local points = {
- [1] = 0,
- [2] = 0,
- [3] = 0,
- [4] = 0,
- }
- local equipos = {}
- local puntos = {}
- local modob = "racing"
- local modo = "bootcamp"
- local modo2 = "Deathmatch"
- local modo2b = "normal"
- local tiempo = 60
- tonumber(tiempo)
- local isfirst = false
- local gameRunning = false
- local winTime = false
- local playersInGame = {}
- local distanciax = 30
- local distanciay = 80
- local textarealugar = 300
- local textareaid = 0
- local mapasmix = {}
- local mapasbootcamp= {}
- local mapasracing = {2806,2283,166705,112790,138678,180619,191753,209708,209799,5053907,152299,168776,401945,185760,150692,362549,589026,1589026,1975684,155168,507308,255542,429897,444490,545493,168776,401945,185760,150692,2262476,1975684,155168,507308,255542,429897,164802,410565,443309,1321417,171152,3453351,215938,410608,2894072,2683170,330441,4238784,2286056,180191,392492,339418,402453,1405249,3778128,178657,2030343,447556,496091,407495,387290,1976007,2806,262144,178545,1595600,1174107,220500,223810,1256845,1448760,232699,2455250,261720,314205,283715,208914,3575425,240973,1252122,759128,355957,6563851,1281700,404440,414683,250610,363638,505963,1987990,138036,586622,360273,382977,136966,1327182,412316,2287914,3822290,1373000,327254,214775,418337,238380,3801780,1694602,6050338,340069,5408572,463195,5422102,262144,586622,418658,397938,4469627,423517,531569,3680220,402274,349389,2423312,2577060,5699298,1975753,4681759,361382,483924,385295,410230,3548376,2134537,3967150,206810,395459,1364063,214037,1208798,391625,359055,401945,117548,216553,130763,217881,144468,219548,223293,225017,229827,229835,232140,232699,233687,234959,235034,235501,246790,245223,248098,252759,253883,261959,263182,278916,422580,387270,146801,1639996,5053907,399673,405295,324355,616433,3639993,1555532,426638,6571336,1973574,407686}
- local maps = mapasracing
- local equipoc= {}
- local colors = {
- [1] = "e54427",
- [2] = "0a98db",
- [3] = "00ff00",
- [4] = "ffff00",
- }
- local queue = {}
- local nteam = 1
- local azar = {}
- local posicion = {}
- local modoazar = ""
- local numeroposicion = 1
- local totales = 0
- local totales2 = 0
- local jugando = {}
- local totaljugando = 1
- local jugandoposicion = {}
- function newMap()
- local mapcode = maps[math.random(#maps)]
- if #queue > 0 then
- mapcode = queue[1]
- table.remove(queue, 1)
- end
- tfm.exec.newGame(mapcode)
- for player, data in pairs(tfm.get.room.playerList) do
- if not playersInGame[player] then
- tfm.exec.killPlayer(player)
- end
- end
- tfm.exec.setGameTime(tiempo)
- if modo2b == "Deathmatch" then
- borrarScoreDeathmatch()
- end
- end
- function modoalazar()
- ui.addTextArea(38, "", nil, 235, 30, 302, 22, 0x324650, 0x5A7A8B, 1, true)
- ui.addTextArea(37, "<p align='center'><V>Administrador: "..ADMINISTRADOR, nil, 235, 30, 300, 20, 0x324650, 0x324650, 1, true)
- ui.addTextArea(2, "", nil, 142, 71, 516, 290, 0x0E1417, 0x0E1417, 1, true)
- ui.addTextArea(4, "", nil, 231, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
- ui.addTextArea(5, "<p align='center'><V>Team 1", nil, 232, 80, 140, 20, 0x324650, 0x324650, 1, true)
- ui.addTextArea(6, "", nil, 399, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
- ui.addTextArea(7, "<p align='center'><V>Team 2", nil, 400, 80, 140, 20, 0x324650, 0x324650, 1, true)
- for i=8, 11 do
- ui.removeTextArea(i)
- end
- ui.addTextArea(40, "", nil, 231, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(31, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 232, 121, 138, 198, 0x324650, 0x324650, 1, true)
- for i=32, 35 do
- ui.removeTextArea(i)
- end
- ui.addTextArea(36, "", nil, 399, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(13, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 400, 121, 138, 198, 0x324650, 0x324650, 1, true)
- ui.addTextArea(14, "<p align='center'><font color='#5A7A8B'>____ ____</font>", nil, 320, 197, 140, 200, 0, 0, 0, true)
- ui.addTextArea(15, "", nil, 367, 202, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(16, "<p align='center'><V>VS", nil, 368, 203, 38, 18, 0x324650, 0x324650, 1, true)
- ui.addTextArea(42, "", ADMINISTRADOR, 600, 81, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(41, "<p align='center'><V><a href='event:salir'>X", ADMINISTRADOR, 601, 82, 38, 18, 0x324650, 0x324650, 1, true)
- ui.addTextArea(45, "", ADMINISTRADOR, 600, 139, 52, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(46, "<p align='center'><V><a href='event:reset'>Reset", ADMINISTRADOR, 601, 140, 50, 18, 0x324650, 0x324650, 1, true)
- ui.addTextArea(47, "", ADMINISTRADOR, 600, 173, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(50, string.format("<p align='center'><V>Modo %s - %s ",modob,modo2b),nil, 235, 375, 300, 17, 0x324650, 0x324650, 1, true)
- ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRADOR, 368, 203, 38, 18, 0x324650, 0x324650, 1, true)
- ui.addTextArea(57, "", ADMINISTRADOR, 600, 207, 57, 25, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(58, "<p align='center'><V><a href='event:volver'><font size='10'>4 Teams", ADMINISTRADOR, 601, 208, 55, 23, 0x324650, 0x324650, 1, true)
- ui.removeTextArea(59)
- ui.removeTextArea(60)
- ui.removeTextArea(53)
- ui.removeTextArea(51)
- ui.removeTextArea(54)
- ui.addTextArea(56, "<p align='center'><V><a href='event:azart'><font size='12'>Azar", ADMINISTRADOR, 601, 246, 55, 18, 0x324650, 0x324650, 1, true)
- verificarmodo2()
- end
- function eventPlayerWon(player)
- if not isfirst then
- isfirst = true
- tfm.exec.setGameTime(3)
- if modo2b == "Deathmatch" then
- if puntos[player] >= WINS - 1 then
- gameRunning = false
- winTime = os.time()
- ui.addTextArea(29, string.format("<p align='center'><font size='37' color='#000000'>%s ganó\nLos otros son perdedores xdxdxd", player), nil, 3, 168, 800, 500, 0, 0, 0, true)
- ui.addTextArea(30, string.format("<p align='center'><font size='37'><font color='#cecece'><font color='#ff0000'>%s </font>ganó\nLos otros son perdedores xdxdxd", player), nil, 1, 170, 800, 500, 0, 0, 0, true)
- ui.addTextArea(16, "<p align='center'><font color='#225066' size='18' face='Tw Cen MT Condensed'><a href='event:iniciarJogo'>DE NUEVO", ADMINISTRADOR, 350, 270, 100, 20, 0xFFFFFF, 0xFFFFFF, 1, true)
- end
- tfm.exec.setGameTime(3)
- puntos[player] = puntos[player]+1
- equipoc[player] = "0x115b17"
- displayScoreDeathmatch()
- end
- if modo2b == "normal" then
- if table.contains(teams[1], player) then
- tfm.exec.setGameTime(3)
- points[1] = points[1]+1
- elseif table.contains(teams[2], player) then
- tfm.exec.setGameTime(3)
- points[2] = points[2]+1
- elseif table.contains(teams[3], player) then
- tfm.exec.setGameTime(3)
- points[3] = points[3]+1
- elseif table.contains(teams[4], player) then
- tfm.exec.setGameTime(3)
- points[4] = points[4]+1
- else
- isfirst = false
- end
- winner = false
- if points[1] >= WINS then
- winner = 1
- elseif points[2] >= WINS then
- winner = 2
- elseif points[3] >= WINS then
- winner = 3
- elseif points[4] >= WINS then
- winner = 4
- end
- if winner then
- gameRunning = false
- winTime = os.time()
- local names = {
- "Rojo",
- "Azul",
- "Verde",
- "Amarillo",
- }
- ui.addTextArea(26, string.format("<p align='center'><font size='37' color='#000000'>El equipo %s Ganó\nLos otros son perdedores xdxdxd", names[winner]), nil, 0, 171, 800, 500, 0, 0, 0, true)
- ui.addTextArea(27, string.format("<p align='center'><font size='37' color='#000000'>El equipo %s Ganó\nLos otros son perdedores xdxdxd", names[winner]), nil, 1, 170, 800, 500, 0, 0, 0, true)
- ui.addTextArea(28, string.format("<p align='center'><font size='37' color='#000000'>El equipo %s Ganó\nLos otros son perdedores xdxdxd", names[winner]), nil, 2, 169, 800, 500, 0, 0, 0, true)
- ui.addTextArea(29, string.format("<p align='center'><font size='37' color='#000000'>El equipo %s Ganó\nLos otros son perdedores xdxdxd", names[winner]), nil, 3, 168, 800, 500, 0, 0, 0, true)
- ui.addTextArea(30, string.format("<p align='center'><font size='37'><font color='#cecece'>El equipo <font color='#%s'>%s</font> Ganó\nLos otros son perdedores xdxdxd", colors[winner], names[winner]), nil, 1, 170, 800, 500, 0, 0, 0, true)
- ui.addTextArea(16, "<p align='center'><font color='#225066' size='18' face='Tw Cen MT Condensed'><a href='event:iniciarJogo'>REVANCHA", ADMINISTRADOR, 350, 270, 100, 20, 0xFFFFFF, 0xFFFFFF, 1, true)
- end
- displayScore()
- end
- end
- end
- function eventLoop(elapsed, remain)
- if gameRunning then
- remain = remain/1000
- if remain < 0 then
- remain = 100
- newMap()
- end
- else
- if winTime then
- if winTime > os.time()-30000 then
- else
- winTime = false
- ui.removeTextArea(26)
- ui.removeTextArea(27)
- ui.removeTextArea(28)
- ui.removeTextArea(29)
- ui.removeTextArea(30)
- displayTeams()
- teams = {
- [1] = {},
- [2] = {},
- [3] = {},
- [4] = {},
- }
- points = {
- [1] = 0,
- [2] = 0,
- [3] = 0,
- [4] = 0,
- }
- playersInGame = {}
- end
- end
- end
- end
- function string.title(s)
- return string.gsub(s, "%a", function(c)
- return string.upper(c)
- end, 1)
- end
- function resetmostrarjugadoresdeathmatch()
- distanciax = 30
- distanciay = 80
- textarealugar = 302
- textareaid = 0
- end
- function eventChatCommand(player, command)
- if modo2b == "Deathmatch" then
- args = string.split(command, " ")
- if args[1] == "puntaje" then
- resetmostrarjugadoresdeathmatch()
- ui.addTextArea(300, "<p align='center'><V><a href='event:cerrarpuntaje'>X", player, 30, 50, 30, 16, 0x324650, 0x324650, 1, true)
- ui.addTextArea(301, string.format("<p align='center'><V>Deathmatch a %s puntos",WINS), player, 80, 45, 180, 18, 0x324650, 0x000000, 1, true)
- for k,players in pairs(tfm.get.room.playerList) do
- if puntos[k] then
- equipos[k] = k
- playersInGame[k] = true
- if textareaid >= 32 then
- else
- ui.addTextArea(textarealugar, string.format("<p align='center'><V>%s - %s",k,puntos[k]), player, distanciax, distanciay, 140, 18, 0x324650, 0x000000, 1, true)
- distanciay = distanciay + 37
- textareaid = textareaid + 1
- textarealugar = textarealugar + 1
- if textareaid == 8 then
- distanciax = distanciax + 190
- distanciay = 80
- textareaid = 0
- end
- end
- end
- end
- end
- end
- if player:lower() == ADMINISTRADOR:lower() then
- args = string.split(command, " ")
- if args[1] == "team1" then
- if modo2b == "normal" then
- table.remove(args, 1)
- teams[1] = {}
- points[1] = 0
- for index, player in pairs(args) do
- player = string.title(player)
- table.insert(teams[1], player)
- playersInGame[player] = true
- end
- if modoazar == "true" then
- modoalazar()
- else
- displayTeams()
- end
- end
- elseif args[1] == "team2" and modo2b == "normal" then
- table.remove(args, 1)
- teams[2] = {}
- points[2] = 0
- for index, player in pairs(args) do
- player = string.title(player)
- table.insert(teams[2], player)
- playersInGame[player] = true
- end
- if modoazar == "true" then
- modoalazar()
- else
- displayTeams()
- end
- elseif args[1] == "team3" and modo2b == "normal" then
- table.remove(args, 1)
- teams[3] = {}
- points[3] = 0
- for index, player in pairs(args) do
- player = string.title(player)
- table.insert(teams[3], player)
- playersInGame[player] = true
- end
- if modoazar == "true" then
- modoalazar()
- else
- displayTeams()
- end
- elseif args[1] == "team4" and modo2b == "normal" then
- table.remove(args, 1)
- teams[4] = {}
- points[4] = 0
- for index, player in pairs(args) do
- player = string.title(player)
- table.insert(teams[4], player)
- playersInGame[player] = true
- end
- if modoazar == "true" then
- modoalazar()
- else
- displayTeams()
- end
- elseif args[1] == "saltar" then
- newMap()
- elseif args[1] == "np" then
- if args[2] then
- table.insert(queue, args[2])
- end
- elseif args[1] == "d" then
- if args[2] then
- WINS = tonumber(args[2])
- displayScore()
- end
- elseif args[1] == "añadir" and modo2b == "Deathmatch" then
- if args[2] then
- table.remove(args, 1)
- for index, player in pairs(args) do
- equipos[player] = player
- puntos[player] = 0
- playersInGame[player] = true
- end
- end
- elseif args[1] == "añadir" and modo2b == "normal" then
- if args[2] and args[3] then
- if args[2] == "team1" and modo2b == "normal" then
- table.remove(args, 1)
- table.remove(args, 1)
- for index, player in pairs(args) do
- player = string.title(player)
- table.insert(teams[1], player)
- playersInGame[player] = true
- end
- end
- if args[2] == "team2" and modo2b == "normal" then
- table.remove(args, 1)
- table.remove(args, 1)
- for index, player in pairs(args, 3) do
- player = string.title(player)
- table.insert(teams[2], player)
- playersInGame[player] = true
- end
- end
- if args[2] == "team3" and modo2b == "normal" then
- table.remove(args, 1)
- table.remove(args, 1)
- for index, player in pairs(args) do
- player = string.title(player)
- table.insert(teams[3], player)
- playersInGame[player] = true
- end
- end
- if args[2] == "team4" and modo2b == "normal" then
- table.remove(args, 1)
- table.remove(args, 1)
- for index, player in pairs(args) do
- player = string.title(player)
- table.insert(teams[4], player)
- playersInGame[player] = true
- end
- end
- end
- elseif args[1] == "quitar" then
- if args[2] then
- for index, player in pairs(args) do
- player = string.title(player)
- playersInGame[player] = false
- end
- end
- elseif args[1] == "reset" then
- teams[1] = {}
- points[1] = 0
- teams[2] = {}
- points[2] = 0
- teams[3] = {}
- points[3] = 0
- teams[4] = {}
- points[4] = 0
- equipos = {}
- puntos = {}
- modob = "racing"
- modo = "bootcamp"
- modo2 = "Deathmatch"
- modo2b = "normal"
- displayTeams()
- elseif args[1] == "puntos" and modo2b == "normal" then
- if args[2] and args[3] then
- local team = tonumber(args[2]:match("team(%d+)") or 0)
- if team > 0 and team < 5 then
- local newScore = tonumber(args[3]) or points[team]
- points[team] = newScore
- displayScore()
- end
- end
- elseif args[1] == "pausa" then
- gameRunning = not gameRunning
- if not gameRunning then
- ui.addTextArea(90, "", nil, 235, 200, 302, 22, 0x324650, 0x5A7A8B, 1, true)
- ui.addTextArea(91, "<p align='center'><V> Juego pausado ", nil, 235, 200, 300, 20, 0x324650, 0x324650, 1, true)
- tfm.exec.disableAutoTimeLeft(true)
- else
- ui.removeTextArea(90)
- ui.removeTextArea(91)
- tfm.exec.disableAutoTimeLeft(false)
- end
- end
- end
- end
- function eventNewGame()
- if gameRunning then
- if modo2b == "normal" then
- isfirst = false
- for i, p in pairs(teams[1]) do
- tfm.exec.setNameColor(p, "0x"..colors[1])
- end
- for i, p in pairs(teams[2]) do
- tfm.exec.setNameColor(p, "0x"..colors[2])
- end
- for i, p in pairs(teams[3]) do
- tfm.exec.setNameColor(p, "0x"..colors[3])
- end
- for i, p in pairs(teams[4]) do
- tfm.exec.setNameColor(p, "0x"..colors[4])
- end
- displayScore()
- end
- if modo2b == "Deathmatch" then
- isfirst = false
- for k,players in pairs(tfm.get.room.playerList) do
- tfm.exec.setNameColor(k, "0xff0000")
- equipoc[k] = "0x324650"
- end
- displayScore()
- end
- end
- end
- function displayScore()
- if modo2b == "normal" then
- if modoazar == "true" then
- ui.addTextArea(25, string.format("<p align='center'><font size='20'><font color='#%s'>%s<N> x <font color='#%s'>%s <N> / <font color='#111111'>%s", colors[1], points[1], colors[2], points[2], WINS), nil, 0, 22, 800, 30, 0, 0, 0, true)
- end
- if modoazar == "false" then
- ui.addTextArea(25, string.format("<p align='center'><font size='20'><font color='#%s'>%s<N> x <font color='#%s'>%s <N> x <font color='#%s'>%s <N> x <font color='#%s'>%s <N> / <font color='#111111'>%s", colors[1], points[1], colors[2], points[2], colors[3], points[3], colors[4], points[4], WINS), nil, 0, 22, 800, 30, 0, 0, 0, true)
- end
- end
- end
- function displayScoreDeathmatch()
- resetmostrarjugadoresdeathmatch()
- ui.addTextArea(300, string.format("<p align='center'><V>Deathmatch a %s puntos",WINS), nil, 80, 45, 180, 18, 0x324650, 0x000000, 1, true)
- for k,players in pairs(tfm.get.room.playerList) do
- if puntos[k] then
- equipos[k] = k
- playersInGame[k] = true
- if textareaid >= 32 then
- else
- ui.addTextArea(textarealugar, string.format("<p align='center'><V>%s - %s",k,puntos[k]), nil, distanciax, distanciay, 140, 18, equipoc[k], 0x000000, 1, true)
- distanciay = distanciay + 37
- textareaid = textareaid + 1
- textarealugar = textarealugar + 1
- if textareaid == 8 then
- distanciax = distanciax + 190
- distanciay = 80
- textareaid = 0
- end
- end
- end
- end
- end
- function borrarScoreDeathmatch()
- for i = 300, 334 do
- ui.removeTextArea(i)
- end
- end
- function displayTeams()
- borrarScoreDeathmatch()
- modoazar = "false"
- ui.addTextArea(38, "", nil, 235, 30, 302, 22, 0x324650, 0x5A7A8B, 1, true)
- ui.addTextArea(37, "<p align='center'><V>Administrador: "..ADMINISTRADOR, nil, 235, 30, 300, 20, 0x324650, 0x324650, 1, true)
- ui.addTextArea(2, "", nil, 0, 71, 800, 290, 0x0E1417, 0x0E1417, 1, true)
- ui.addTextArea(4, "", nil, 57, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
- ui.addTextArea(5, "<p align='center'><V>Team 1", nil, 58, 80, 140, 20, 0x324650, 0x324650, 1, true)
- ui.addTextArea(6, "", nil, 227, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
- ui.addTextArea(7, "<p align='center'><V>Team 2", nil, 228, 80, 140, 20, 0x324650, 0x324650, 1, true)
- ui.addTextArea(8, "", nil, 417, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
- ui.addTextArea(9, "<p align='center'><V>Team 3", nil, 418, 80, 140, 20, 0x324650, 0x324650, 1, true)
- ui.addTextArea(10, "", nil, 587, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
- ui.addTextArea(11, "<p align='center'><V>Team 4", nil, 588, 80, 140, 20, 0x324650, 0x324650, 1, true)
- ui.addTextArea(12, "<p align='center'><font color='#5A7A8B'>|</font>", nil, 210, 102, 140, 200, 0, 0, 0, true)
- ui.addTextArea(39, "<p align='center'><font color='#5A7A8B'>|</font>", nil, 450, 102, 140, 200, 0, 0, 0, true)
- ui.addTextArea(40, "", nil, 59, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(31, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 60, 121, 138, 198, 0x324650, 0x324650, 1, true)
- ui.addTextArea(32, "", nil, 419, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(33, "<p align='center'><font color='#"..colors[3].."'>"..table.concat(teams[3], "\n"), nil, 420, 121, 138, 198, 0x324650, 0x324650, 1, true)
- ui.addTextArea(34, "", nil, 589, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(35, "<p align='center'><font color='#"..colors[4].."'>"..table.concat(teams[4], "\n"), nil, 590, 121, 138, 198, 0x324650, 0x324650, 1, true)
- ui.addTextArea(36, "", nil, 229, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(13, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 230, 121, 138, 198, 0x324650, 0x324650, 1, true)
- ui.addTextArea(14, "<p align='center'><font color='#5A7A8B'>____ ____</font>", nil, 325, 197, 140, 200, 0, 0, 0, true)
- ui.addTextArea(15, "", nil, 374, 202, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(16, "<p align='center'><V>VS", nil, 375, 203, 38, 18, 0x324650, 0x324650, 1, true)
- ui.addTextArea(42, "", ADMINISTRADOR, 749, 81, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(41, "<p align='center'><V><a href='event:salir'>X", ADMINISTRADOR, 750, 82, 38, 18, 0x324650, 0x324650, 1, true)
- ui.addTextArea(45, "", ADMINISTRADOR, 744, 139, 52, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(46, "<p align='center'><V><a href='event:reset'>Reset", ADMINISTRADOR, 745, 140, 50, 18, 0x324650, 0x324650, 1, true)
- ui.addTextArea(47, "", ADMINISTRADOR, 741, 173, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(54, "", ADMINISTRADOR, 741, 209, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- if modo2 == "Deathmatch" then
- ui.addTextArea(51, "<p align='center'><V><a href='event:Deathmatch'><font size='8'>"..modo2, ADMINISTRADOR, 742, 210, 55, 18, 0x324650, 0x324650, 1, true)
- end
- verificarmodo()
- ui.addTextArea(53, "", ADMINISTRADOR, 741, 245, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(56, "<p align='center'><V><a href='event:llenar'><font size='12'>Llenar", ADMINISTRADOR, 742, 246, 55, 18, 0x324650, 0x324650, 1, true)
- ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRADOR, 375, 203, 38, 18, 0x324650, 0x324650, 1, true)
- ui.addTextArea(57, "", ADMINISTRADOR, 741, 281, 57, 25, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(58, "<p align='center'><V><a href='event:azart'><font size='12'>", ADMINISTRADOR, 742, 282, 55, 23, 0x324650, 0x324650, 1, true)
- ui.addTextArea(59, "<p align='center'><V><a href='event:azart'><font size='12'>teams", ADMINISTRADOR, 742, 290, 55, 23, 0x000000, 0x000000, 1, true)
- ui.addTextArea(60, "<p align='center'><V><a href='event:azart'><font size='12'>Azar 2", ADMINISTRADOR, 742, 278, 55, 23, 0x000000, 0x000000, 1, true)
- end
- function verificarmodo()
- ui.addTextArea(50, string.format("<p align='center'><V>Modo %s - %s ",modob,modo2b),nil, 235, 375, 300, 17, 0x324650, 0x324650, 1, true)
- if modo2 == "normal" then
- ui.addTextArea(51, "<p align='center'><V><a href='event:normal'><font size='8'>"..modo2, ADMINISTRADOR, 742, 210, 55, 18, 0x324650, 0x324650, 1, true)
- end
- if modo == "bootcamp" then
- ui.addTextArea(48, "<p align='center'><V><a href='event:bootcamp'><font size='9'>"..modo, ADMINISTRADOR, 742, 174, 55, 18, 0x324650, 0x324650, 1, true)
- end
- if modo == "racing" then
- ui.addTextArea(48, "<p align='center'><V><a href='event:racing'><font size='9'>"..modo, ADMINISTRADOR, 742, 174, 55, 18, 0x324650, 0x324650, 1, true)
- end
- if modo == "mix" then
- ui.addTextArea(48, "<p align='center'><V><a href='event:mix'><font size='9'>"..modo, ADMINISTRADOR, 742, 174, 55, 18, 0x324650, 0x324650, 1, true)
- end
- end
- function contarjugadores()
- local players=0
- function eventNewPlayer(name)--Cuando un jugador entre a la sala...
- players=players+1--Sumamos 1 a nuestra tabla
- end
- function eventPlayerLeft(name)--Cuando un jugador salga de la sala...
- players=players-1--Restamos 1 a nuestra tabla
- end
- for name in pairs(tfm.get.room.playerList) do--Por cada jugador que esté en la sala...
- eventNewPlayer(name)--Le ejecutamos la función eventNewPlayer
- end
- end
- function eventTextAreaCallback(id, player, callback)
- if callback == 'iniciarJogo' then
- gameRunning = true
- for i = 1, 20 do
- ui.removeTextArea(i)
- end
- for i = 26, 60 do
- ui.removeTextArea(i)
- end
- borrarScoreDeathmatch()
- newMap()
- if modo2b == "normal" then
- points[1] = 0
- points[2] = 0
- points[3] = 0
- points[4] = 0
- displayScore()
- end
- if modo2b == "Deathmatch" then
- for k,v in pairs(tfm.get.room.playerList) do
- puntos[k] = 0
- end
- end
- end
- if callback == 'salir' then
- tfm.system.exit()
- end
- if callback == 'llenar' then
- nteam = 1
- azar = {}
- playersInGame = {}
- teams = {
- [1] = {},
- [2] = {},
- [3] = {},
- [4] = {},
- }
- contarjugadores()
- for k,players in pairs(tfm.get.room.playerList) do
- if nteam > 4 then
- nteam = 1
- end
- table.insert(teams[nteam], k)
- playersInGame[k] = true
- nteam = nteam + 1
- displayTeams()
- end
- end
- if callback == 'reset' then
- teams[1] = {}
- points[1] = 0
- teams[2] = {}
- points[2] = 0
- teams[3] = {}
- points[3] = 0
- teams[4] = {}
- points[4] = 0
- equipos = {}
- puntos = {}
- modob = "racing"
- modo = "bootcamp"
- modo2 = "Deathmatch"
- modo2b = "normal"
- displayTeams()
- end
- if callback == 'bootcamp' then
- tiempo = 150
- modob = "bootcamp"
- modo = "mix"
- verificarmodo()
- maps = mapasbootcamp
- end
- if callback == 'racing' then
- tiempo = 60
- modob = "racing"
- modo = "bootcamp"
- verificarmodo()
- maps = mapasracing
- end
- if callback == 'mix' then
- tiempo = 90
- modob = "mix"
- modo = "racing"
- verificarmodo()
- maps = mapasmix
- end
- if callback == 'Deathmatch' then
- modo2b = "Deathmatch"
- modo2 = "normal"
- displayTeams()
- for i = 4, 15 do
- ui.removeTextArea(i)
- end
- for i = 31, 36 do
- ui.removeTextArea(i)
- end
- for i = 39, 40 do
- ui.removeTextArea(i)
- end
- ui.removeTextArea(53)
- ui.removeTextArea(56)
- contarjugadores()
- for k,players in pairs(tfm.get.room.playerList) do
- equipos[k] = k
- puntos[k] = 0
- equipoc[k] = "0x324650"
- playersInGame[k] = true
- if textareaid >= 32 then
- else
- ui.addTextArea(textarealugar, "<p align='center'><V>"..k, nil, distanciax, distanciay, 140, 18, 0x324650, 0x324650, 1, true)
- distanciay = distanciay + 37
- textareaid = textareaid + 1
- textarealugar = textarealugar + 1
- if textareaid == 8 then
- distanciax = distanciax + 190
- distanciay = 80
- textareaid = 0
- end
- ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRADOR, 375, 203, 38, 18, 0x324650, 0x324650, 1, true)
- end
- end
- end
- if callback == 'normal' then
- modo2b = "normal"
- modo2 = "Deathmatch"
- resetmostrarjugadoresdeathmatch()
- displayTeams()
- end
- if callback == 'cerrarpuntaje' then
- borrarScoreDeathmatch()
- end
- if callback == 'azart' then
- totales = 0
- totales2 = 0
- jugando = {}
- totaljugando = 1
- jugandoposicion = {}
- playersInGame = {}
- teams[1] = {}
- teams[2] = {}
- teams[3] = {}
- teams[4] = {}
- alazar()
- borrarScoreDeathmatch()
- modoazar = "true"
- modoalazar()
- end
- if callback == 'volver' then
- totales = 0
- totales2 = 0
- jugando = {}
- totaljugando = 1
- jugandoposicion = {}
- playersInGame = {}
- teams[1] = {}
- teams[2] = {}
- teams[3] = {}
- teams[4] = {}
- displayTeams()
- end
- if callback == 'bootcamp2' then
- tiempo = 150
- modob = "bootcamp"
- modo = "mix"
- verificarmodo2()
- maps = mapasbootcamp
- end
- if callback == 'racing2' then
- tiempo = 60
- modob = "racing"
- modo = "bootcamp"
- verificarmodo2()
- maps = mapasracing
- end
- if callback == 'mix2' then
- tiempo = 90
- modob = "mix"
- modo = "racing"
- verificarmodo2()
- maps = mapasmix
- end
- end
- function alazar()
- t = 0
- for k,v in pairs(tfm.get.room.playerList) do
- if t == 1 then
- table.insert(teams[2], k)
- playersInGame[k] = true
- t = 0
- elseif t == 0 then
- table.insert(teams[1], k)
- playersInGame[k] = true
- t = 1
- end
- end
- end
- function verificarmodo2()
- ui.addTextArea(50, string.format("<p align='center'><V>Modo %s - %s ",modob,modo2b),nil, 235, 375, 300, 17, 0x324650, 0x324650, 1, true)
- if modo == "bootcamp" then
- ui.addTextArea(48, "<p align='center'><V><a href='event:bootcamp2'><font size='9'>"..modo, ADMINISTRADOR, 601, 174, 55, 18, 0x324650, 0x324650, 1, true)
- end
- if modo == "racing" then
- ui.addTextArea(48, "<p align='center'><V><a href='event:racing2'><font size='9'>"..modo, ADMINISTRADOR, 601, 174, 55, 18, 0x324650, 0x324650, 1, true)
- end
- if modo == "mix" then
- ui.addTextArea(48, "<p align='center'><V><a href='event:mix2'><font size='9'>"..modo, ADMINISTRADOR, 601, 174, 55, 18, 0x324650, 0x324650, 1, true)
- 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
- function table.contains(tableT, element)
- for _, value in pairs(tableT) do
- if value == element then
- return true
- end
- end
- return false
- end
- function eventPlayerDied()
- local alive = 0
- for k,v in pairs(tfm.get.room.playerList) do
- if not v.isDead then
- alive = alive+1
- end
- end
- if alive == 0 then
- newMap()
- end
- end
- displayTeams()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement