Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --valiu
- -- djskjakjd
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disablePhysicalConsumables(true)
- -- te observo ^-^
- local removerText = {}
- local jugadorCantidad = {}
- local lugares = {}
- local verTimes = {}
- local juego_activo = false
- local teams = {Team1 = {}, Team2 = {}}
- local puntos = {team1 = 0, team2 = 0}
- local respawnPlayer = {}
- local times = {}
- local bestTimes = {}
- local ez_maps = {
- 113156, 124000, 149422, 149451, 150651, 150664, 151655, 152260, 152733,
- 153996, 155480, 155606, 155611, 155628, 155765, 156720, 157203, 157805,
- 157960, 158345, 158417, 158909, 159187, 159298, 159932, 160841, 161023,
- 161434, 162482, 163159, 163172, 163506, 163531, 163596, 164544, 164916,
- 165186, 166032, 177652, 166056, 166271, 166333, 166361, 166430, 166805,
- 167075, 167903, 168204, 167903, 168754, 169059, 169076, 169110, 169139,
- 171148, 171480, 171482, 171776, 172501, 172512, 172520, 172547, 172605,
- 172621, 172951, 172976, 173623, 173816, 174223, 175204, 175280, 176253,
- 176507, 176710, 176729, 179005, 179488, 179492, 179807, 180801, 182370,
- 182769, 183139, 183141, 184648, 184817, 184868, 185289, 185428, 185529,
- 185529, 185873, 185887, 186066, 189819, 190646, 190996, 191177, 191203,
- 191205, 191443, 191642, 192158, 192255, 192959, 193662, 195116, 195672,
- 197229, 198988, 199210, 199710, 199826, 201000, 202574, 203664, 204488,
- 204647, 205240, 205506, 206396, 208056, 208373, 232675, 208653, 208940,
- 209848, 213752, 213755, 213874, 214631, 214755, 216173, 217261, 220352,
- 222377, 222910, 223947, 2795201, 225744, 226266, 227093, 230588, 231137,
- 231921, 232469, 232678, 235037, 236768, 237091, 242291, 250153, 254785,
- 257218, 257324, 257715, 258192258908, 259319, 261298, 261814, 263819,
- 263926, 264091, 268915, 270143, 270924, 271193, 271411, 159145, 272402,
- 272518, 272689, 277427, 277513, 514311, 277824, 279337, 281948, 282584,
- 284134, 286254, 289865, 2574744, 295465, 295630, 295932, 297442, 299942,
- 299983, 301610, 302080, 303151, 303939, 304861, 305567, 305614, 305820,
- 306365, 306384, 313216, 314743, 315666, 315800, 316012, 318129, 319443,
- 320483, 320626, 322582, 327354, 329318, 329571, 330933, 330967, 331344,
- 331988, 332130, 332906, 333002, 336305, 337644, 342035, 343456, 354984,
- 361500, 365061, 368839, 372419, 392240, 393426, 394132, 395216, 395310,
- 395961, 397467, 397469, 399364, 401630, 403755, 403940, 408577, 408643,
- 410040, 410045, 412467, 412913, 419335, 419369, 419635, 420877, 422981,
- 423311, 424604, 424685, 424900, 425884, 431433, 431749, 432501, 435812,
- 438333, 438364, 439092, 444589, 447805, 449496, 454049, 455271, 457726,
- 458528, 460961, 467137, 476706, 478236, 492222, 492399, 496610, 496886,
- 497965, 499986, 500690, 500748, 500894, 504485, 505619, 506032, 506613,
- 506940, 510996, 511136, 512887, 523270, 528032, 531084, 541223, 541693,
- 541729, 543010, 551317, 556841, 380516, 557066, 560583, 562897, 563436,
- 564198, 568122, 571683, 586901, 592189, 593164, 593431, 593530, 596239,
- 605255, 608368, 618999, 684566, 692650, 692740, 783547, 801683, 815336,
- 834297, 842019, 842167, 868262, 898934, 912356, 919484, 976944, 1000006,
- 1004622, 1014313, 1018394, 1157281, 1162831, 1164086, 1242584, 1255359,
- 536905, 1265789, 1266330, 1383297, 1384078, 1413528, 1427980, 1435902,
- 1494499, 1503203, 1526894, 1531604, 1540221, 1580356, 1580835, 1593066,
- 1595965, 1615753, 1615949, 1647131, 1678634, 1722755, 1733211, 1788490,
- 1807217, 1809410, 2040569, 2130169, 2311703, 2423300, 256899, 2520540,
- 2636519, 2738370, 2794566, 2989803, 3136410, 3199998, 3242049, 3908151,
- 4067327, 4445580, 330841, 2176211, 373105, 375455, 376704, 378704, 2252731,
- 1646448, 4488666, 698992, 3888888, 4627777, 528782, 192519, 159691, 158053,
- 3907267, 3848147, 2692883, 5517891, 7016000, 215933, 343875, 507884, 597348,
- 720672, 1951944, 2850177, 2918822, 3043779, 3076903, 3200001, 3483300,
- 3527399, 3937567, 4854539, 1893451, 5534007
- }
- local med_maps = {
- 6892200, 6000050, 157004, 158345, 158417, 163094, 7288650, 3473925, 192560,
- 216171, 2795201, 263819, 4617716, 590775, 306655, 307324, 327743, 2914456,
- 372255, 391924, 392240, 397478, 3133917, 2932238, 438364, 482791, 500000,
- 522719, 552986, 557074, 560583, 587501, 2242899, 612415, 721319, 722837,
- 562897, 563436, 564198, 568122, 571683, 574183, 575497, 584783, 560526,
- 729863, 374995, 758595, 881158, 886744, 970919, 1046877, 1066607, 1130256,
- 1156092, 1226207, 1301649, 1303323, 1323048, 1333846, 1384078, 1410539,
- 1620703, 1955745, 1989803, 1990413, 2024960, 2178800, 2329940, 2416969,
- 2469365, 2788517, 2846829, 3038589, 3668888, 3690269, 3988424, 549666,
- 4114521, 1523082, 5960814, 1256085, 6137767, 4890068, 557132, 357892,
- 273373, 225484, 5000126, 6533602, 6574593, 293559, 6696038, 6600067,
- 4763378, 1601992, 4770120, 6774534, 4877895, 425533, 556973, 4769901,
- 406154, 6642996, 6675248, 223174, 6999009, 4895345, 655207, 823329, 2082776,
- 2309030, 2963166, 2999994, 3828508, 3976977, 4107909, 4632975, 5092739,
- 6593495, 6727980, 2803483, 4237910, 4538472, 3521460, 2128560, 3493490,
- 4362335, 2294519, 6000033, 6284671, 7196861, 7261219, 6640663, 7306627,
- 7324922, 6000044, 7110102, 7370291, 6931020, 7290999, 7000002, 7512725,
- 7598733
- }
- local hard_maps = {
- 329200, 2417098, 654894, 1111252, 2514792, 4224188, 290824, 5994088
- }
- local ultra_maps = {}
- local time_map = 363 -- (segundos)
- c_ez = 2
- c_m = 0
- c_h = 0
- c_u = 0
- local puesto_1 = false
- local puesto_2 = false
- local puesto_3 = false
- local admin = {
- ["Blood#3565"] = true,
- ["Misterthepro#0000"] = true,
- ["Edudekarly#3398"] = true,
- ["His#0439"] = true
- }
- local alreadyRespawn = {}
- local recordsActivos = {}
- local mapActual = ""
- -- local mapa_bc_actual = false LA QUE USAMOS SE LLAMA MAP_BC_ACTUAL LOL XD
- local mejorTiempo = " "
- local last_map = false
- local time_lobby = 666
- local firstMap = true
- local estado
- local new_map = false
- local dificultadMap = ""
- ---te amo---
- --- uwu --
- function newMap()
- puesto_1 = false
- puesto_2 = false
- puesto_3 = false
- primero = ""
- segundo = ""
- tercero = ""
- for i = 31, 40 do
- ui.removeTextArea(i, nil)
- end
- if c_ez == 0 and c_m == 0 and c_h == 0 and c_u == 0 then
- addpoints_time(times)
- if #times >= 1 then
- table.insert(bestTimes, {
- mapa = times[1].mapa,
- time = times[1].time,
- name = times[1].name
- })
- end
- last_map = true
- end
- if last_map then
- tfm.exec.newGame(7692692)
- time_map = 1234567
- tfm.exec.setGameTime(time_map)
- mejoresTimes()
- puntuacion_final()
- juego_activo = false
- elseif not map_bc_actual then
- mejorTiempo = " "
- times = {}
- str = "\n<textformat tabstops='[70, 170, 300]'>"
- lugares = {}
- juego_activo = true
- map_bc_actual = true
- math.randomseed(os.time())
- if c_ez ~= 0 then
- estado = 1
- local map = ez_maps[math.random(#ez_maps)]
- tfm.exec.newGame(map)
- c_ez = c_ez - 1
- dificultadMap = "<font color='#00C17C'>Fácil</font>"
- elseif c_m ~= 0 then
- estado = 2
- local map = med_maps[math.random(#med_maps)]
- tfm.exec.newGame(map)
- c_m = c_m - 1
- dificultadMap = "<font color='#EBC244'>Medio</font>"
- elseif c_h ~= 0 then
- estado = 3
- local map = hard_maps[math.random(#hard_maps)]
- tfm.exec.newGame(map)
- dificultadMap = "<font color='#F93018'>Difícil</font>"
- -- print(time_map) --
- c_h = c_h - 1
- elseif c_u ~= 0 then
- estado = 4
- local map = ultra_maps[math.random(#ultra_maps)]
- tfm.exec.newGame(map)
- dificultadMap = "<font color='#F93018'>Ultra</font>"
- c_u = c_u - 1
- -- else
- end
- for p, v in pairs(tfm.get.room.playerList) do
- if jugador_activo(p, lista_A) == false and
- jugador_activo(p, lista_B) == false then
- tfm.exec.killPlayer(p)
- end
- end
- else
- juego_activo = true
- tfm.exec.newGame(7692692)
- -- tfm.exec.setGameTime(7)
- map_bc_actual = false
- addpoints_time(times)
- recordsLobby()
- if #times >= 1 then
- table.insert(bestTimes, {
- mapa = times[1].mapa,
- time = times[1].time,
- name = times[1].name
- })
- end
- end
- end
- function puntuacion_final()
- ui.addTextArea ( 300, "<p align='center'><font size ='13' color='#00C17C'><b>Puntuacion Final", nil , 420, 125, 0, 20, 0x2B2B2B, 0x121212, 1, true)
- ui.addTextArea ( 301, "<p align='center'><font size ='13' color='#CB546B'><b>Red: " .. puntos.team1 .. "<p align='center'><font size ='13' color='#2F7FCC'><b>\nBlue: ".. puntos.team2 , nil , 420, 160, 0, 20, 0x2B2B2B, 0x121212, 1, true)
- if puntos.team1 > puntos.team2 then
- ui.addTextArea ( 302, "<p align='center'><font size ='13' color='#CB546B'><b> WIN RED: " .. puntos.team1 .. " points " , nil , 420, 215, 0, 20, 0x2B2B2B, 0x121212, 1, true)
- elseif puntos.team1 < puntos.team2 then
- ui.addTextArea ( 302, "<p align='center'><font size ='13' color='#2F7FCC'><b> WIN BLUE: " .. puntos.team2 .. " points " , nil , 420, 215, 0, 20, 0x2B2B2B, 0x121212, 1, true)
- else
- ui.addTextArea ( 302, "<p align='center'><font size ='13' color='EEEFF6'><b> Empate con: " .. puntos.team1 .. " - " .. puntos.team2 , nil , 420, 215, 0, 20, 0x2B2B2B, 0x121212, 1, true)
- end
- end
- function mejoresTimes()
- mejoresTiempos = "\n<textformat tabstops='[75, 230]'>"
- color = ""
- for i, completion in ipairs(bestTimes) do
- if jugador_activo(completion.name, teams.Team1) then
- jugador = "<font color = '#CB546B'>" .. completion.name .. "</font>"
- elseif jugador_activo(completion.name, teams.Team2) then
- jugador = "<font color = '#2F7FCC'>" .. completion.name .. "</font>"
- end
- mejoresTiempos = mejoresTiempos ..
- ("<font color='#00C17C'>@" .. completion.mapa ..
- '</font>' .. "\t " .. jugador .. '\t ' ..
- " <font color='#00C17C'> " .. completion.time ..
- 's</font>\n')
- end
- mejoresTiempos = mejoresTiempos .. '</textformat>'
- ui.addTextArea(51, "<br>" .. mejoresTiempos, player, 100, 140, 0, 0,
- 0x2B2B2B, 0x121212, 1, true)
- ui.addTextArea(50,
- "<p align='center'><font size ='13' color='#00C17C'><b>Mejores Tiempos",
- player, 190, 125, 0, 20, 0x2B2B2B, 0x121212, 1, true)
- end
- function eventNewGame()
- if juego_activo then mapActual = tfm.get.room.xmlMapInfo.mapCode end
- for name in pairs(tfm.get.room.playerList) do colores(name) end
- if map_bc_actual or new_map then
- ui.removeTextArea(40, player)
- ui.removeTextArea(41, player)
- tfm.exec.setGameTime(time_map)
- else
- tfm.exec.setGameTime(time_lobby)
- end
- if firstMap then
- firstMap = false
- tfm.exec.setGameTime(10000)
- end
- end
- function eventNewPlayer(player)
- respawnPlayer[player] = os.time()
- verTimes[player] = false
- teclas(player)
- end
- function teclas(player)
- tfm.exec.bindKeyboard(player, 76, false, true)
- tfm.exec.bindKeyboard(player, 46, false, true)
- tfm.exec.bindKeyboard(player, 16, false, true)
- end
- for player in next, tfm.get.room.playerList do
- eventNewPlayer(player)
- verTimes[player] = false
- teclas(player)
- end
- function eventPlayerDied(player) respawnPlayer[player] = os.time() end
- function setNewMap()
- math.randomseed(os.time())
- if estado == 1 then
- local map = ez_maps[math.random(#ez_maps)]
- tfm.exec.newGame(map)
- elseif estado == 2 then
- local map = med_maps[math.random(#med_maps)]
- tfm.exec.newGame(map)
- elseif estado == 3 then
- local map = hard_maps[math.random(#hard_maps)]
- tfm.exec.newGame(map)
- elseif estado == 4 then
- local map = ultra_maps[math.random(#utra_maps)]
- tfm.exec.newGame(map)
- end
- end
- function eventLoop(time, remaining)
- if new_map then
- setNewMap()
- new_map = false
- end
- if remaining < 500 then newMap() end
- for i, n in pairs(respawnPlayer) do
- if n <= os.time() - 1000 then
- lista_A = teams.Team1
- lista_B = teams.Team2
- if jugador_activo(i, lista_A) or jugador_activo(i, lista_B) then
- tfm.exec.respawnPlayer(i)
- colores(i)
- end
- end
- end
- if juego_activo then
- minutos = "0" .. math.floor((remaining / 1000) / 60)
- segundos = math.floor(remaining / 1000) % 60
- if segundos <= 9 then segundos = "0" .. segundos end
- if #times >= 1 then
- mejorTiempo = times[1].name .. " " .. times[1].time .. "s"
- end
- for i, n in pairs(removerText) do
- if n <= os.time() - 2000 then ui.removeTextArea(69, i) end
- end
- if (time_map == 1234567) then
- tfm.exec.setUIMapName(
- " <font color='#CB546B'>Red: " ..
- puntos.team1 .. "</font>\t|\t<font color='#2F7FCC'> Blue: " ..
- puntos.team2 .. "</font>\t|\t" .. "\t\t" .. "\n")
- else
- --[[ barra = dificultadMap .. " <font color='#CB546B'>Red: " ..
- puntos.team1 .. "</font>\t|\t<font color='#2F7FCC'> Blue: " ..
- puntos.team2 .. "</font>\t|\t" .. minutos .. ":" .. segundos ..
- "\t|\t" .. mejorTiempo .. "\n"
- print(#barra) ]]
- tfm.exec.setUIMapName(dificultadMap .. " <font color='#CB546B'>Red: " ..
- puntos.team1 .. "</font>\t|\t<font color='#2F7FCC'> Blue: " ..
- puntos.team2 .. "</font>\t|\t" .. minutos .. ":" .. segundos ..
- "\t|\t" .. mejorTiempo .. "\n")
- end
- end
- end
- function eventChatCommand(playerName, command)
- local args = {}
- for arg in command:gmatch("[^%s]+") do table.insert(args, arg) end
- -- comandos para admins:
- if admin[playerName] then
- if args[1] == "team1" then -- y sigue con team1
- teams.Team1 = {}
- for i = 2, #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
- table.remove(teams.Team2, j)
- -- ui.updateTextArea(667, "<p align='center'><font color='#2F7FCC'>" .. (table.concat(teams.Team2,"\n") or ""), nil)
- end
- end
- if not jugador_activo(args[i], teams.Team1) then
- table.insert(teams.Team1, args[i])
- colores(args[i])
- end
- end
- if juego_activo == false then grafico() end
- elseif args[1] == "team2" then -- y sigue con team2
- teams.Team2 = {}
- for i = 2, #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
- table.remove(teams.Team1, j)
- -- ui.updateTextArea(666, "<p align='center'><font color='#CB546B'>" .. (table.concat(teams.Team1,"\n") or ""), nil)
- end
- end
- if not jugador_activo(args[i], teams.Team2) then
- table.insert(teams.Team2, args[i])
- colores(args[i])
- end
- end
- if juego_activo == false then grafico() end
- elseif args[1] == "add" then
- if args[2] == "team1" then
- 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
- table.remove(teams.Team2, j)
- -- ui.updateTextArea(4, "<p align='center'><font color='#2F7FCC'>" .. (table.concat(teams.Team2,"\n") or ""), nil)
- end
- end
- -- if jugadorSinEquipo(args[i]) then
- if not jugador_activo(args[i], teams.Team1) then
- table.insert(teams.Team1, args[i])
- colores(args[i])
- end
- -- end
- end
- end
- if args[2] == "team2" then
- for i = 3, #args do
- for j = 1, #teams.Team1 do
- if args[i] == teams.Team1[j] then
- table.remove(teams.Team1, j)
- ui.updateTextArea(3,
- "<p align='center'><font color='#CB546B'>" ..
- (table.concat(teams.Team1,
- "\n") or ""),
- nil)
- end
- end
- -- if jugadorSinEquipo(args[i]) then
- if not jugador_activo(args[i], teams.Team2) then
- table.insert(teams.Team2, args[i])
- colores(args[i])
- end
- -- end
- end
- end
- if juego_activo == false then grafico() end
- elseif args[1] == "records" then
- if recordsActivos[playerName] then
- recordsActivos[playerName] = false
- else
- recordsActivos[playerName] = true
- end
- verRecords(playerName)
- elseif args[1] == "time" then
- tfm.exec.setGameTime(3)
- elseif args[1] == "fix" then
- tfm.exec.setGameTime(time_map - 3) -- le restamos los 3s del respawn
- elseif args[1] == "map" and juego_activo then
- new_map = true
- elseif args[1] == "mapas" then
- if tonumber(args[3]) ~= nil then
- if args[2] == "ez" then
- c_ez = tonumber(args[3])
- elseif args[2] == "med" then
- c_m = tonumber(args[3])
- elseif args[2] == "hard" then
- c_h = tonumber(args[3])
- elseif args[2] == "ultra" then
- c_u = tonumber(args[3])
- end
- cantidadMaps()
- end
- elseif args[1] == "t" then
- if tonumber(args[3]) ~= nil then
- if args[2] == "mapas" then
- time_map = tonumber(args[3])
- elseif args[2] == "lobby" then
- time_lobby = tonumber(args[3])
- end
- cantidadMaps()
- end
- end
- end -- admin[playername]
- -- COMANDOS PARA NO ADMINS:
- if args[1] == "vertimes" then
- if verTimes[playerName] == false then
- verTimes[playerName] = true
- else
- verTimes[playerName] = false
- end
- end
- end
- function add_points(playerName, p)
- if jugador_activo(playerName, teams.Team1) then
- puntos.team1 = puntos.team1 + p
- elseif jugador_activo(playerName, teams.Team2) then
- puntos.team2 = puntos.team2 + p
- end
- end
- function eventPlayerWon(playerName, tiempoRonda, tiempoRespawn)
- if puesto_1 == false then
- table.insert(lugares, {name = playerName, puesto = 1})
- puesto_1 = true
- tfm.exec.setPlayerScore(playerName, 4, true)
- add_points(playerName, 4)
- elseif puesto_2 == false then
- table.insert(lugares, {name = playerName, puesto = 2})
- puesto_2 = true
- tfm.exec.setPlayerScore(playerName, 3, true)
- add_points(playerName, 3)
- elseif puesto_3 == false then
- table.insert(lugares, {name = playerName, puesto = 3})
- puesto_3 = true
- tfm.exec.setPlayerScore(playerName, 2, true)
- add_points(playerName, 2)
- else
- tfm.exec.setPlayerScore(playerName, 1, true)
- add_points(playerName, 1)
- end
- if verTimes[playerName] then
- if jugador_activo(playerName, teams.Team1) then
- ui.addTextArea(69,
- "<b><font size ='15' color='#CB546B'>" .. playerName ..
- "</font> <font size ='15'>" .. tiempoRespawn /
- 100 .. "s</font>", playerName, 9, 368, 0, 0,
- 0x2B2B2B, 0, 0.7, true)
- elseif jugador_activo(playerName, teams.Team2) then
- ui.addTextArea(69,
- "<b><font size ='15' color='#2F7FCC'>" .. playerName ..
- "</font> <font size ='15'>" .. tiempoRespawn /
- 100 .. "s</font>", playerName, 9, 368, 0, 0,
- 0x2B2B2B, 0, 0.7, true)
- end
- end
- str = "\n<textformat tabstops='[70, 170, 300]'>"
- table.insert(times, {
- time = tiempoRespawn / 100,
- name = playerName,
- mapa = mapActual
- })
- if not alreadyRespawn[playerName] then
- times[#times].time = times[#times].time - 3
- end
- table.sort(times, function(i, v) return i.time < v.time end)
- for i, completion in ipairs(times) do
- if jugador_activo(completion.name, teams.Team1) then
- jugador = "<font color = '#CB546B'>" .. completion.name .. "</font>"
- elseif jugador_activo(completion.name, teams.Team2) then
- jugador = "<font color = '#2F7FCC'>" .. completion.name .. "</font>"
- end
- removerText[playerName] = os.time()
- if i <= 15 then
- if i < 10 then i = 0 .. i end
- str = str ..
- (i .. ' | ' .. jugador .. '\t| ' ..
- completion.time .. 's\n')
- end
- end
- str = str .. '</textformat>'
- for player, p in pairs(tfm.get.room.playerList) do verRecords(player) end
- end
- function eventKeyboard(player, key, down, x, y)
- if key == 76 then
- if recordsActivos[player] then
- recordsActivos[player] = false
- else
- recordsActivos[player] = true
- end
- verRecords(player)
- elseif key == 46 or key == 16 then
- tfm.exec.killPlayer(player)
- end
- end
- function colores(playerName)
- if jugador_activo(playerName, teams.Team1) then
- tfm.exec.setNameColor(playerName, 0xCB546B)
- elseif jugador_activo(playerName, teams.Team2) then
- tfm.exec.setNameColor(playerName, 0x2F7FCC)
- end
- end
- function jugador_activo(player, L) -- L lista de jugadores --
- for _, v in pairs(L) do if player == v then return true end end
- return false
- end
- function verRecords(player)
- if recordsActivos[player] then
- ui.addTextArea(40, str, player, 275, 80, 250, 200, 0x2B2B2B, 0x121212,
- 1, true)
- ui.addTextArea(41,
- "<p align='center'><font size ='13' color='#00C17C'><b>Tiempos",
- player, 352, 65, 100, 20, 0x2B2B2B, 0x121212, 1, true)
- else
- ui.removeTextArea(40, player)
- ui.removeTextArea(41, player)
- end
- end
- function recordsLobby()
- jugador = "\n\n"
- jugadoresTimes = "\n<textformat tabstops='[190]'>"
- jugadorCantidad = {}
- jugadoresCantidad = "\n<textformat tabstops='[190]'>"
- table.sort(lugares, function(i, v) return i.puesto < v.puesto end)
- for i, nombreJugador in ipairs(lugares) do
- if jugador_activo(nombreJugador.name, teams.Team1) then
- jugador = jugador .. "<font color='#00C17C'>" .. "0" .. nombreJugador.puesto .. "</font> " .. "<font color = '#CB546B'>" .. nombreJugador.name .. "</font>\n"
- elseif jugador_activo(nombreJugador.name, teams.Team2) then
- jugador = jugador .. "<font color='#00C17C'>" .. "0" .. nombreJugador.puesto .. "</font> " .. "<font color = '#2F7FCC'>" .. nombreJugador.name .. "</font>\n"
- end
- end
- for i = 1, 3 do
- if jugador_activo(times[i].name, teams.Team1) then
- jugadoresTimes = jugadoresTimes .. "<font color='#CB546B'>" .. times[i].name .. "\t</font><font color = '#00C17C'>" .. times[i].time .. "s</font>\n"
- elseif jugador_activo(times[i].name, teams.Team2) then
- jugadoresTimes = jugadoresTimes .. "<font color='#2F7FCC'>" .. times[i].name .. "\t</font><font color = '#00C17C'>" .. times[i].time .. "s</font>\n"
- end
- end
- local cont = 1
- local cont_ult
- local names = {}
- local name_cant = {}
- local canti = {}
- for i = 1, #times do
- table.insert(names, times[i].name)
- end
- table.sort(names, function(a,b) return #a < #b end)
- if #times == 1 then
- table.insert(name_cant, {nombre = names[1], cantidad = 1})
- elseif #times == 2 then
- if names[1] == names[2] then
- table.insert(name_cant, {nombre = names[1], cantidad = 2})
- else
- table.insert(name_cant, {nombre = names[1], cantidad = 1})
- table.insert(name_cant, {nombre = names[2], cantidad = 1})
- end
- else
- local nombre_actual
- for i = 2 , #times do
- nombre_actual = names[i-1]
- if names[i-1] == names[i] then
- cont = cont + 1
- cont_ult = cont
- else
- table.insert(name_cant, {nombre = nombre_actual, cantidad = cont})
- cont = 1
- end
- end
- table.insert(name_cant, {nombre = nombre_actual, cantidad = cont_ult})
- end
- for i, jugadorNombre in ipairs(name_cant) do
- if jugador_activo(jugadorNombre.nombre, teams.Team1) then
- jugadoresCantidad = jugadoresCantidad .. "<font color='#CB546B'>" .. jugadorNombre.nombre .. "\t</font><font color = '#00C17C'>" .. jugadorNombre.cantidad .. "</font>\n"
- elseif jugador_activo(jugadorNombre.nombre, teams.Team2) then
- jugadoresCantidad = jugadoresCantidad .. "<font color='#2F7FCC'>" .. jugadorNombre.nombre .. "\t</font><font color = '#00C17C'>" .. jugadorNombre.cantidad .. "</font>\n"
- end
- end
- ui.addTextArea(31, "<p align='center'> <font size ='16' color='#00C17C'><b>Estadísticas", nil, 20, 137, 760, 220, 0x1E1E1E, 0x121212,
- 1, true)
- ui.addTextArea(32, "<p align='center'><font size ='15' color='#00C17C'><b>Tiempos</b></font></p>" .. jugadoresTimes, nil, 35, 170, 230, 170, 0x2B2B2B, 0x2B2B2B,
- 1, true)
- ui.addTextArea(33, "<p align='center'><font size ='15' color='#00C17C'><b>Cantidades</b></font></p>" .. jugadoresCantidad, nil, 285, 170, 230, 170, 0x2B2B2B, 0x2B2B2B,
- 1, true)
- ui.addTextArea(34, "<p align='center'><font size ='15' color='#00C17C'><b>Lugares</b></font>" .. jugador, nil, 535, 170, 230, 170, 0x2B2B2B, 0x2B2B2B,
- 1, true)
- end
- --
- function rcorrer_times(L, cantidad_times)
- local t = 4
- for i = 1, cantidad_times, 1 do
- add_points(L[i].name, t)
- tfm.exec.setPlayerScore(L[i].name, t, true)
- t = t / 2
- end
- end
- function addpoints_time(L)
- if #L >= 3 then
- rcorrer_times(L, 3)
- elseif #L == 2 then
- rcorrer_times(L, 2)
- elseif #L == 1 then
- rcorrer_times(L, 1)
- end
- end
- function establecerEquipos()
- teams.Team1 = {}
- teams.Team2 = {}
- local equipo = 1
- local jugadoresTotal = {}
- for name, p in pairs(tfm.get.room.playerList) do
- table.insert(jugadoresTotal, name)
- end
- for i = 1, #jugadoresTotal do
- numJugador = math.random(#jugadoresTotal)
- agregarJugador = jugadoresTotal[numJugador]
- table.remove(jugadoresTotal, numJugador)
- if equipo == 1 then
- table.insert(teams.Team1, agregarJugador)
- equipo = 2
- elseif equipo == 2 then
- table.insert(teams.Team2, agregarJugador)
- equipo = 1
- end
- end
- grafico()
- end
- function establecerPuntos()
- for name in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore(name, 0)
- end
- end
- function eventTextAreaCallback(id, player, callback)
- if admin[player] then
- if callback == 'equiposRandom' then
- establecerEquipos()
- colores()
- elseif callback == 'vaciarTeams' then
- teams.Team1 = {}
- teams.Team2 = {}
- grafico()
- elseif callback == 'iniciarJuego' then
- for i = 661, 671 do ui.removeTextArea(i) end
- newMap()
- establecerPuntos()
- end
- end
- end
- function grafico()
- ui.addTextArea(661, "", nil, 300, 143, 200, 13, 0x2B2B2B, 0x121212, 0.7,
- true)
- ui.addTextArea(662, "", nil, 300, 243, 200, 13, 0x2B2B2B, 0x121212, 0.7,
- true)
- ui.addTextArea(666, "<p align='center'><font color='#CB546B'>" ..
- (table.concat(teams.Team1, "\n") or ""), nil, 150, 140,
- 175, 200, 0x2B2B2B, 0x121212, 1, true)
- ui.addTextArea(667, "<p align='center'><font color='#2F7FCC'>" ..
- (table.concat(teams.Team2, "\n") or ""), nil, 450, 140,
- 175, 200, 0x2B2B2B, 0x121212, 1, true)
- ui.addTextArea(664, "<p align='center'><font color='#CB546B'><b>Team 1",
- nil, 143, 115, 190, 20, 0x2B2B2B, 0x121212, 1, true)
- ui.addTextArea(665, "<p align='center'><font color='#2F7FCC'><b>Team 2",
- nil, 443, 115, 190, 20, 0x2B2B2B, 0x121212, 1, true)
- ui.addTextArea(668,
- "<p align='center'><V><a href='event:iniciarJuego'><font color='#F93018'><b>Iniciar",
- nil, 363, 140, 0, 0, 0x2B2B2B, 0x121212, 1, true)
- ui.addTextArea(663, "", nil, 290, 343, 200, 13, 0x2B2B2B, 0x121212, 1, true)
- ui.addTextArea(669,
- "<p align='center'><V><a href='event:equiposRandom'><font color='#00C17C'><b>Llenar",
- nil, 463, 341, 0, 0, 0x2B2B2B, 0x121212, 1, true)
- ui.addTextArea(670,
- "<p align='center'><V><a href='event:vaciarTeams'><font color='#00C17C'><b>Vaciar",
- nil, 263, 341, 0, 0, 0x2B2B2B, 0x121212, 1, true)
- end
- function cantidadMaps()
- if juego_activo == false then
- for name in pairs(admin) do
- ui.addTextArea(671,
- "<b><font color='#00C17C' size ='12'>Ez Maps " ..
- c_ez ..
- "</font>\n<font color='#EBC244' size ='12'>Med Maps " ..
- c_m ..
- "</font>\n<font color='#CB546B' size ='12'>Hard Maps " ..
- c_h ..
- "</font>\n<font color='#F93018' size ='12'>Ult Maps " ..
- c_u ..
- "</font>\n\n<BV><font size ='12'>Time Map " ..
- time_map .. "\nTime Lob " .. time_lobby, name,
- 10, 143, 100, 0, 0x2B2B2B, 0x121212, 0.7, true)
- end
- end
- end
- function main()
- tfm.exec.newGame(7692636)
- grafico()
- tfm.exec.setGameTime(10000)
- cantidadMaps()
- end
- main()
- function eventPlayerRespawn(playerName) alreadyRespawn[playerName] = true end
- -- hola amiguitos
- -- ui.addTextArea ( id, texto, jogador, x, y, largura, altura, corFundo, corBorda, opacidade, posicaoFixa )
- --Mostra uma textarea.
- -- Parâmetros:
- -- - id (Int) : o id da textarea
- -- - texto (String) : o texto a ser mostrado
- -- - jogador (String) : o jogador que poderá ver a popup (se nil, aplica-se para todos os jogadores)
- -- - x (Int) : a coordenada horizontal do topo, a esquerda (valor padrão = 50)
- -- - y (Int) : a coordenada vertical do topo, a esquerda (valor padrão = 50)
- -- - largura (Int) : a largura em pixeis da textarea (se 0, será ajustado de acordo com a largura do texto) (valor padrão = 0)
- -- - altura (Int) : a altura em pixeis da textarea (se 0, será ajustado de acordo com a altura do texto) (valor padrão = 0)
- -- - corFundo (Int) : a cor de fundo da textarea (valor padrão = 0x324650)
- -- - corBorda (Int) : a cor da borda da textarea (valor padrão = 0)
- -- - opacidade (Number) : a opacidade do fundo da textarea, de 0 (transparente) até 1 (opaco) (valor padrão = 1)
- -- - posicaoFixa (Boolean) : se a posição é fixa ou se deve seguir o jogador em mapas longos (valor padrão = false)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement