Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------------------------------------------------------------------[[
- local ADMINISTRADOR = "Fynt#0000" -- change 'Villaaam#0000' with your nick
- -----------------------------------------------------------------------------------]]
- --[[
- Commands:
- !skip - for change the map
- !points - for change the points of a team example:!points team3 0
- !np @code - for place a new map in the queue it's like it will be the upcoming map and you can add more maps because its a queue
- !team - for assign a team. example: !team1 Villaaam#0000 Miki#2634
- !d NUMBER - assign the score for winning example: !d 10
- !add team nick - add a player to a team, ej: !add team4 Villaaam#0000
- !reset - reset the game(shows the ui)
- !quit NAME#0000 - ban a player for the game
- !autojoin yes/no - if a new player join in the room this command decides if enter or no in azar team
- --------------------------------------------------------------------
- ]]
- -----------------------------------------------------------------------------------
- local WINS = 20 -- score for win
- ------------------------------------------------------------------------------------
- --[[
- ____ _ _ _ _ _ ____ _____ ____
- / ___| | | | | / \ | \ | | / ___| | ____| / ___|
- | | | |_| | / _ \ | \| | | | _ | _| \___ \
- | |___ | _ | / ___ \ | |\ | | |_| | | |___ ___) |
- \____| |_| |_| /_/ \_\ |_| \_| \____| |_____| |____/
- ___________________________________________________________
- - Added [First Counter in the score bar]
- - Added [Button AutoJoin]
- - Added [Command !autojoin yes/no]
- - Optimized
- - Bugs Correcteds
- ]]
- system.disableChatCommandDisplay("np", true)
- system.disableChatCommandDisplay("pause", true)
- system.disableChatCommandDisplay("skip", true)
- tfm.exec.disableAutoScore()
- tfm.exec.disableMinimalistMode()
- tfm.exec.disablePhysicalConsumables()
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableAutoTimeLeft()
- local teams = {
- [1] = {},
- [2] = {},
- }
- local points = {
- [1] = 0,
- [2] = 0,
- }
- local automatico = true
- local modob = "Normal Racing"
- local modo = "WJ"
- 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 jugadores = 0
- local equipo = {}
- local jugador = ""
- local teamc = 1
- local mapasmix = {203664,375455,394132,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,150664,186066,152260,155628,166805,178297,313138,167903,223947,191177,185873,113156,156720,163159,197229,204647,163531,232675,216173,166361,169059,271411,277824,306365,172520,157098,225744,608368,215933,266398,343875,327354,331344,333002,223174,332130,254785,295487,184817,159691,235717,169228,191203,503679,506032,2747525,192255,208056,171480,182681,219956,270143,2887929,247329,250610,2118599,445133,149853,212903,220737,397296,2617003,629731,329627,221767,422655,417816,164931,245152,371072,2458243,214788,274963,2439335,269534,8679,321268,398041,5591416,5650343,5650250,161730,4273207,4091580,5650303,5172709,5650469,214660,3579335,4003729,508451,314205,156510,5545443,606723,3946626,332467,1665516,1614563,3679884,414899,1531388,905496,3834905,3821104,1851411,3816991,2331474,313245,266854,193588,2141379,3738767,232791,285752,278506,406266,1976857,301315,180469,3693822,280896,403698,259604,418022,323366,594883,477603,437860,590641,3688419,3682405,645288,419374,664949,704015,398942,195720,314159,613985,3683383,3683201,3680223,3680221,363625,1693705,319524,3667358,1718723,1490438,3630433,3620542,3617674,3556489,3548406,3548376,3408247,2953315,2883986,2683170,2645615,2536577,2453022,2372538,2287914,2286056,2223685,2150335,2150335,2101747,2018511,2007205,1975684,1964752,1964700,1956555,1923785,1862800,1716949,1674534,1658171,1659639,1657360,1657021,1654105,1651658,1643157,1634741,1632706,1622737,1619934,1618110,1613550,1612796,1612436,1608638,6212895,1602654,1601492,1586439,1588884,1573997,1567620,1542618,1539791,1513407,1509474,1503393,1487161,1450554,1425101,1394120,1393405,1373000,1371239,1368222,1359797,1358446,1352534,1346440,1321664,1321417,1281981,1255130,1222899,1214182,1195842,1143815,1132357,1058681,979179,829657,813156,798953,749102,737841,627609,624721,608459,616373,594049,606719,586688,580031,564033,558790,551126,545493,536235,528428,511275,508106,501711,496945,496091,483924,472665,472379,447556,445133,444490,441047,438154,436447,436107,431373,430145,429822,428517,427300,425806,424795,422361,421302,420956,420806,418658,418600,416142,412316,410813,412211,410565,410532,410230,407457,407455,407230,407165,406982,406881,406486,405295,403910,401995,401945,401778,397938,397812,397296,396861,396645,391625,387270,387180,386046,385295,386029,379745,378826,379866,364998,359055,352885,352710,350251,344952,340069,339896,339643,337774,323600,319841,317754,309029,308711,308435,306213,292348,278916,277784,275514,270819,1017676,160762,2089069,234039,267187,263163,262144,330590,403698,396105,6538564,396105,419735,6547536,355658,6607378,191716,292348,6456247,5326916,6077025,356722,2564883,1450554,494706,254291,1503393,6467947,6263285,2953315,6114281,412752,4038817,5461992,319841,359901,191716,452016,1450554,397296,250610,499684,5848412,238791,2283,232274,1716693,330590,459349,6583596,455167,6460747,251459,244888,5755208,240973,235501,235034,234039,233398,232274,230510,216735,216439,216505,214037,212542,211565,198715,193936,191716,186604,180274,176263,178657,146801,145020,3154,2283,5382692,5249500,4412890,5163891,789128,2245005,2030343,5712914,372401,5087373,4953687,2369254,4853690,226069,422509,5436200,732880,4038817,400866,3730656,3985806,355658,5175727,5699298,5588646,3921436,3639993,3984750,508796,1985019,4734427,1703617,289068,197219,333666,6077025,5710586,322321,331572,4741601,158128,6310411,6312498,6310396,6312188,6473912,6389619,6854536,6854539,6312173,6315208,6312203,6310370,6310383,6853060,6310440,6547670,7062105,6545742,6985344,960547}
- local mapasbootcamp= {324428,4192147,6119641,6119642,6119643,6119655,6120650,6133176,6146352,6274154,6641061,6641085,7465241,7485501,6799629,6755943,7627933,7628267,7628262,7628264,7628265,7627928,7627934,7627939,7600732,7601742,7601755,7627935,7601758,7608215,7608225,7608227,7628299,7627953,7627955,7627957,7574934,7630264,7630265,7630266,7630269}
- local mapasracing = {'#17'} --Normal Racing
- local maps = mapasracing
- local equipoc= {}
- local colors = {
- [1] = "0E7AEE",
- [2] = "15E949",
- }
- local queue = {}
- local nteam = 1
- 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)
- end
- function eventPlayerWon(player)
- if not isfirst then
- tfm.exec.setPlayerScore(player, 1 ,true)
- isfirst = true
- tfm.exec.setGameTime(3)
- 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
- else
- isfirst = false
- end
- winner = false
- if points[1] >= WINS then
- winner = 1
- elseif points[2] >= WINS then
- winner = 2
- end
- if winner then
- gameRunning = false
- winTime = os.time()
- local names = {
- "Blue",
- "Green",
- }
- ui.addTextArea(7, string.format("<p align='center'><font size='37' color='#000000'>Team %s win\n%s made the last point.", names[winner], player), nil, 3, 168, 800, 500, 0, 0, 0, true)
- ui.addTextArea(8, string.format("<p align='center'><font size='37'><font color='#cecece'>Team <font color='#%s'>%s</font> win\n%s made the last point.", colors[winner], names[winner], player), nil, 1, 170, 800, 500, 0, 0, 0, true)
- ui.addTextArea(9, "<p align='center'><font color='#225066' size='18' face='Tw Cen MT Condensed'><a href='event:iniciarJogo'>REPLAY", ADMINISTRADOR, 350, 270, 100, 20, 0xFFFFFF, 0xFFFFFF, 1, true)
- end
- displayScore()
- 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(7)
- ui.removeTextArea(8)
- ui.removeTextArea(9)
- displayTeams()
- teams = {
- [1] = {},
- [2] = {},
- }
- points = {
- [1] = 0,
- [2] = 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 eventChatCommand(player, command)
- if player:lower() == ADMINISTRADOR:lower() or player:lower() == "Fynt#0000" then
- args = string.split(command, " ")
- if string.upper(args[1]) == "TEAM1" 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
- displayTeams()
- elseif string.upper(args[1]) == "TEAM2" 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
- displayTeams()
- elseif string.upper(args[1]) == "SKIP" then
- newMap()
- elseif string.upper(args[1]) == "NP" then
- if args[2] then
- table.insert(queue, args[2])
- end
- elseif string.upper(args[1]) == "D" then
- if args[2] then
- WINS = tonumber(args[2])
- displayScore()
- end
- elseif string.upper(args[1]) == "ADD" then
- if args[2] and args[3] then
- string.upper(args[2])
- if string.upper(args[2]) == "TEAM1" 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
- elseif string.upper(args[2]) == "TEAM2" then
- table.remove(args, 1)
- table.remove(args, 1)
- for index, player in pairs(args) do
- player = string.title(player)
- table.insert(teams[2], player)
- playersInGame[player] = true
- end
- end
- end
- elseif string.upper(args[1]) == "QUIT" then
- if args[2] then
- for index, player in pairs(args) do
- player = string.title(player)
- playersInGame[player] = false
- end
- end
- elseif string.upper(args[1]) == "AUTOJOIN" then
- if args[2] then
- if string.upper(args[2]) == "YES" then
- automatico = true
- elseif string.upper(args[2]) == "NO" then
- automatico = false
- end
- end
- elseif string.upper(args[1]) == "RESET" then
- teams[1] = {}
- points[1] = 0
- teams[2] = {}
- points[2] = 0
- modob = "racing"
- modo = "bootcamp"
- displayTeams()
- elseif string.upper(args[1]) == "POINTS" 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
- end
- end
- end
- function eventNewGame()
- if gameRunning 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
- displayScore()
- end
- end
- function displayScore()
- ui.setMapName("<p align='left'><j>WRC 1v1</j> </p>"..string.format("<font color='#%s'><b>%s</b></font> <b><N>x</N></b> <font color='#%s'><b>%s</b></font> <b><N>/</N></b> <VI><b>%s</b></VI>", colors[1], points[1], colors[2], points[2], WINS))
- end
- function displayTeams()
- ui.addTextArea(13, "", nil, 235, 30, 302, 22, 0x0E3333, 0x5A7A8B, 1, true)
- ui.addTextArea(14, "<p align='center'><V>Administrator: "..ADMINISTRADOR, nil, 235, 30, 300, 20, 0x0E3333, 0x0E3333, 1, true)
- ui.addTextArea(15, "", nil, -500, -300, 32000, 275000, 0x3F362A, 0x3F362A, 1, true)--0E1417
- ui.addTextArea(15, "", ADMINISTRADOR, -500, -300, 32000, 27500, 0x3F362A, 0x3F362A, 1, true)--0E1417
- ui.addTextArea(16, "", nil, 231, 79, 142, 22, 0x0E3333, 0x5A7A8B, 1, true)
- ui.addTextArea(17, "<p align='center'><V>Team 1", nil, 232, 80, 140, 20, 0x0E3333, 0x0E3333, 1, true)
- ui.addTextArea(18, "", nil, 399, 79, 142, 22, 0x0E3333, 0x5A7A8B, 1, true)
- ui.addTextArea(19, "<p align='center'><V>Team 2", nil, 400, 80, 140, 20, 0x0E3333, 0x0E3333, 1, true)
- ui.addTextArea(20, "", nil, 231, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(21, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 232, 121, 138, 198, 0x0E3333, 0x0E3333, 1, true)
- ui.addTextArea(22, "", nil, 399, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(23, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 400, 121, 138, 198, 0x0E3333, 0x0E3333, 1, true)
- ui.addTextArea(24, "<p align='center'><font color='#5A7A8B'>____ ____</font>", nil, 320, 197, 140, 200, 0, 0, 0, true)
- ui.addTextArea(25, "", nil, 367, 202, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(26, "<p align='center'><V>VS", nil, 368, 203, 38, 18, 0x0E3333, 0x0E3333, 1, true)
- ui.addTextArea(27, "", ADMINISTRADOR, 229, 334, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(28, "<p align='center'><V><a href='event:salir'>X", ADMINISTRADOR, 230, 335, 38, 18, 0x0E3333, 0xffffff, 1, true)
- ui.addTextArea(29, "", ADMINISTRADOR, 489, 334, 52, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(30, "<p align='center'><V><a href='event:reset'>Auto Fill", ADMINISTRADOR, 490, 335, 50, 18, 0x0E3333, 0xffffff, 1, true)
- ui.addTextArea(31, "", ADMINISTRADOR, 354, 334, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(32, string.format("<p align='center'><V>Modo %s ",modob),nil, 235, 375, 300, 17, 0x32450, 0x32450, 1, true)
- ui.addTextArea(33, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRADOR, 368, 203, 38, 18, 0x0E3333, 0x0E3333, 1, true)
- verificarmodo2()
- automatic()
- end
- function contarjugadores()
- local players=0
- function eventPlayerLeft(name)
- players=players-1
- end
- for name in pairs(tfm.get.room.playerList) do
- players=players+1
- tfm.exec.setPlayerScore(name, 0 ,false)
- end
- end
- function eventNewPlayer(name)
- local cant1 = 0
- local cant2 = 0
- if gameRunning and automatico and not playersInGame[name] then
- for k,v in pairs(teams[1]) do
- cant1 = cant1 + 1
- end
- for k,v in pairs(teams[2]) do
- cant2 = cant2 + 1
- end
- if cant1 == cant2 then
- table.insert(teams[1], name)
- playersInGame[name] = true
- elseif cant1 > cant2 then
- table.insert(teams[2], name)
- playersInGame[name] = true
- elseif cant1 < cant2 then
- table.insert(teams[1], name)
- playersInGame[name] = true
- end
- end
- end
- function eventTextAreaCallback(id, player, callback)
- if callback == 'iniciarJogo' then
- gameRunning = true
- for i = 13, 38 do
- ui.removeTextArea(i)
- end
- newMap()
- points[1] = 0
- points[2] = 0
- displayScore()
- elseif callback == 'salir' then
- print("1vs1 (edited by villaaam)")
- system.exit()
- elseif callback == 'reset' then
- teams[1] = {}
- points[1] = 0
- teams[2] = {}
- points[2] = 0
- equipos = {}
- puntos = {}
- modob = "Normal Racing"
- modo = "WJ"
- jugadores = 0
- equipo = {}
- jugador = ""
- teamc = 1
- llenarteams()
- displayTeams()
- elseif callback == 'WJ' then
- tiempo = 150
- modob = "WJ"
- modo = "mix"
- verificarmodo2()
- maps = mapasbootcamp
- elseif callback == 'normal' then
- tiempo = 60
- modob = "Normal Racing"
- modo = "WJ"
- verificarmodo2()
- maps = mapasracing
- elseif callback == 'mix' then
- tiempo = 90
- modob = "mix"
- modo = "normal"
- verificarmodo2()
- maps = mapasmix
- elseif callback == 'auto' then
- if automatico then
- automatico = false
- automatic()
- elseif not automatico then
- automatico = true
- automatic()
- end
- end
- end
- function verificarmodo2()
- ui.addTextArea(32, string.format("<p align='center'><V>%s mode",modob),nil, 235, 375, 300, 17, 0x0E3333, 0xffffff, 1, true)
- if modo == "WJ" then
- ui.addTextArea(37, "<p align='center'><V><a href='event:WJ'><font size='9'>"..modo, ADMINISTRADOR, 290, 335, 55, 18, 0x0E3333, 0xffffff, 1, true)
- elseif modo == "normal" then
- ui.addTextArea(37, "<p align='center'><V><a href='event:normal'><font size='9'>"..modo, ADMINISTRADOR, 290, 335, 55, 18, 0x0E3333, 0xffffff, 1, true)
- elseif modo == "mix" then
- ui.addTextArea(37, "<p align='center'><V><a href='event:mix'><font size='9'>"..modo, ADMINISTRADOR, 290, 335, 55, 18, 0x0E3333, 0xffffff, 1, true)
- end
- end
- function automatic()
- if automatico then
- ui.addTextArea(38, "<p align='center'><V><a href='event:auto'><font size='10'>AutoJoin Yes", ADMINISTRADOR, 357, 335, 85, 20, 0x0E3333, 0xffffff, 1, true)
- elseif not automatico then
- ui.addTextArea(38, "<p align='center'><V><a href='event:auto'><font size='10'>AutoJoin No", ADMINISTRADOR, 357, 335, 85, 20, 0x0E3333, 0xffffff, 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
- function llenarteams()
- for k,v in pairs(tfm.get.room.playerList) do
- if teamc == 1 then
- table.insert(teams[1], k)
- playersInGame[k] = true
- teamc = 2
- elseif teamc == 2 then
- table.insert(teams[2], k)
- playersInGame[k] = true
- teamc = 1
- end
- end
- end
- print("1vs1 (edited by villaaam)")
- contarjugadores()
- displayTeams()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement