KevinK_O

Lua Burlas

Sep 20th, 2020
774
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[  
  2.  
  3. -----------------------------------------------------------------------------------]]
  4. local ADMINISTRADOR = "+Lknx#0000" --
  5. -----------------------------------------------------------------------------------]]
  6. --[[                                                                
  7. Comandos:
  8. !saltar - Para cambiar de mapa
  9. !puntos  - Para cambiar el puntaje, ej: !puntos team1 5  
  10. !np @codigo - Para poner cualquier mapa
  11. !pausar - Para pausar el juego
  12. !team - Para asignar jugadores a un equipo, ej: !team1 Kmo#7926
  13. !resultado NUMERO - Asigna el puntaje para ganar, ej: !d 20
  14. !añadir team nick - Añade un jugador a el equipo especificado, ej: !añadir team4 Kmo#7926
  15. !reiniciar - Resetea el juego
  16. !quitar NOMBRE - saca a un jugador del juego
  17. !puntaje - para ver el puntaje [SOLO EN MODO DEATHMATCH]
  18. --------------------------------------------------------------------
  19. ]]
  20. -----------------------------------------------------------------------------------
  21. local WINS = 20 -- Puntaje para ganar.
  22. ------------------------------------------------------------------------------------
  23. --[[
  24. ]]
  25.  
  26. system.disableChatCommandDisplay("np", true)
  27. system.disableChatCommandDisplay("pausar", true)
  28. system.disableChatCommandDisplay("saltar", true)
  29. system.disableChatCommandDisplay("puntaje", true)
  30. system.disableChatCommandDisplay("team1", true)
  31. system.disableChatCommandDisplay("team2", true)
  32. system.disableChatCommandDisplay("team3", true)
  33. system.disableChatCommandDisplay("team4", true)
  34. system.disableChatCommandDisplay("team5", true)
  35. system.disableChatCommandDisplay("team6", true)
  36. system.disableChatCommandDisplay("team7", true)
  37. system.disableChatCommandDisplay("team8", true)
  38. system.disableChatCommandDisplay("reiniciar", true)
  39. system.disableChatCommandDisplay("resultado", true)
  40. system.disableChatCommandDisplay("añadir", true)
  41. system.disableChatCommandDisplay("quitar", true)
  42. system.disableChatCommandDisplay("puntos", true)
  43. tfm.exec.disablePhysicalConsumables()
  44. tfm.exec.disableAutoShaman()
  45. tfm.exec.disableAutoNewGame()
  46. tfm.exec.disableAutoTimeLeft()
  47. local teams = {
  48.     [1] = {},
  49.     [2] = {},
  50.     [3] = {},
  51.     [4] = {},
  52.     [5] = {},
  53.     [6] = {},
  54.     [7] = {},
  55.     [8] = {},
  56. }
  57. local points = {
  58.     [1] = 0,
  59.     [2] = 0,
  60.     [3] = 0,
  61.     [4] = 0,
  62.     [5] = 0,
  63.     [6] = 0,
  64.     [7] = 0,
  65.     [8] = 0,
  66. }
  67. local equipos = {}
  68. local puntos = {}
  69. local maxPlayers = 200
  70. local modob = "racing"
  71. local modo = "bootcamp"
  72. local modo2 = "Deathmatch"
  73. local modo2b = "burlas"
  74. local tiempo = 120
  75. tonumber(tiempo)
  76. local isfirst = false
  77. local gameRunning = false
  78. local winTime = false
  79. local playersInGame = {}
  80. local distanciax = 30
  81. local distanciay = 80
  82. local textarealugar = 300
  83. local textareaid = 0
  84. 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}
  85. local mapasbootcamp= {203664,375455,394132,173816,562897,171148,166430,169076,330933,168754,159145,163596,152733,410040,158909,261814,281985,2176211,270924,1324259,1225867,563436,424604,172547,168204,2693344,193662,305680,149451,2466489,292808,438333,394125,162482,304861,458528,159298,184648,268915,329318,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,2789121,492399,314743,6924913,2918822,232469,397469,280949,176729,292668,242291,294478,2669415,354984,514311,814311,295465,2239788,187478,212322,249760,476706,298424,263819,175280,3920916,330841,554154,439092,232678,395216,399364,4000008,543010,571683,3958217,329571,6680648,3603631,272402,3161324,2682583,371579,2961800,3734998,2719419,255943,313214}
  86. local mapasracing =
  87. {7650244,7650262,7650264,7650266,7650267,7650268,7650271,7650273,7650274,7650278,7650279,7650280,7650281,7650282,7650283,7650286,7650289,7650291,7650292,7650293,7650295,7650297,7650298,7650300,7650303,7650304,7650306,7650307,7650309,7650310,7650311,7650314,7650316,7650317,7650320,7650321,7650323,7650325,7650327,7650329,7650331,7650333,7650335,7650336,7650338,7650339,7650341,7650342,7650344,7650347,7650349,7650350,7650352,7650354,7650356,7650359,7650360,7650361,7650362,7650363,7650366,7650367,7650370,7650371,7650372,7650374,7650375,7650377,7650378,7650379,7650380,7650381,7650384,7650385}
  88. local maps = mapasracing
  89. local equipoc= {}
  90. local colors = {
  91.     [1] = "FF0000",
  92.     [2] = "003AFF",
  93.     [3] = "00FF04",
  94.     [4] = "FF9E00",
  95.     [5] = "FBFF00",
  96.     [6] = "AE00FF",
  97.     [7] = "FF0097",
  98.     [8] = "060606",
  99. }
  100. local queue = {}
  101. local nteam = 1
  102. local azar = {}
  103. local posicion = {}
  104. local modoazar = ""
  105.  
  106. local numeroposicion = 1
  107. local totales = 0
  108. local totales2 = 0
  109. local jugando = {}
  110. local totaljugando = 1
  111. local jugandoposicion = {}
  112. function newMap()
  113.     local mapcode = maps[math.random(#maps)]
  114.     if #queue > 0 then
  115.         mapcode = queue[1]
  116.         table.remove(queue, 1)
  117.     end
  118.     ui.removeTextArea(100, nil)
  119.     tfm.exec.newGame(mapcode)
  120.     tfm.exec.setUIMapName("")
  121.     for player, data in pairs(tfm.get.room.playerList) do
  122.         if not playersInGame[player] then
  123.             tfm.exec.killPlayer(player)
  124.         end
  125.     end
  126.     tfm.exec.setGameTime(tiempo)
  127.     if modo2b == "Deathmatch" then
  128.     borrarScoreDeathmatch()
  129.     end
  130. end
  131.  
  132. function modoalazar()
  133.     ui.addTextArea(38, "", nil, 235, 30, 302, 22, 0x324650, 0x5A7A8B, 1, true)
  134.     ui.addTextArea(37, "<p align='center'><font face='Century Gothic'><font size='12'>Administrador: "..ADMINISTRADOR, nil, 235, 30, 300, 20, 0x324650, 0x324650, 1, true)
  135.     ui.addTextArea(2, "", nil, 142, 71, 516, 290, 0x0E1417, 0x0E1417, 1, true)
  136.     ui.addTextArea(4, "", nil, 231, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  137.     ui.addTextArea(5, "<p align='center'><font face='Century Gothic'><font size='11'>Equipo 1", nil, 232, 80, 140, 20, 0x324650, 0x324650, 1, true)
  138.     ui.addTextArea(6, "", nil, 399, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  139.     ui.addTextArea(7, "<p align='center'><font face='Century Gothic'><font size='11'>Equipo 2", nil, 400, 80, 140, 20, 0x324650, 0x324650, 1, true)
  140.     for i=8, 11 do
  141.     ui.removeTextArea(i)
  142.     end
  143.     ui.addTextArea(40, "", nil, 231, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  144.     ui.addTextArea(31, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 232, 121, 138, 198, 0x324650, 0x324650, 1, true)
  145.     for i=32, 35 do
  146.     ui.removeTextArea(i)
  147.     end
  148.     ui.addTextArea(36, "", nil, 399, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  149.     ui.addTextArea(13, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 400, 121, 138, 198, 0x324650, 0x324650, 1, true)
  150.     ui.addTextArea(14, "<p align='center'><font color='#5A7A8B'>____         ____</font>", nil, 320, 197, 140, 200, 0, 0, 0, true)
  151.     ui.addTextArea(15, "", nil, 367, 202, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  152.     ui.addTextArea(16, "<p align='center'><font face='Century Gothic'>VS", nil, 368, 203, 38, 18, 0x324650, 0x324650, 1, true)
  153.     ui.addTextArea(42, "", ADMINISTRADOR, 600, 81, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  154.     ui.addTextArea(41, "<p align='center'><font face='Century Gothic'><a href='event:salir'>X", ADMINISTRADOR, 601, 82, 38, 18, 0x324650, 0x324650, 1, true)
  155.     ui.addTextArea(45, "", ADMINISTRADOR, 600, 139, 52, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  156.     ui.addTextArea(46, "<p align='center'><font face='Century Gothic'><a href='event:reset'>Reiniciar", ADMINISTRADOR, 601, 140, 50, 18, 0x324650, 0x324650, 1, true)
  157.     ui.addTextArea(47, "", ADMINISTRADOR, 600, 173, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  158.     ui.addTextArea(50, string.format("<p align='center'><font face='Century Gothic'><font size='11'>Modo %s - %s ",modob,modo2b),nil, 235, 375, 300, 17, 0x324650, 0x324650, 1, true)
  159.  
  160.  
  161.  
  162.     ui.addTextArea(16, "<p align='center'><font face='Century Gothic'><a href='event:iniciarJogo'>Iniciar", ADMINISTRADOR, 368, 203, 38, 18, 0x324650, 0x324650, 1, true)
  163.     ui.addTextArea(57, "", ADMINISTRADOR, 600, 207, 57, 25, 0x5A7A8B, 0x5A7A8B, 1, true)
  164.     ui.addTextArea(58, "<p align='center'><font face='Century Gothic'><a href='event:volver'><font size='11'>8 Teams", ADMINISTRADOR, 601, 208, 55, 23, 0x324650, 0x324650, 1, true)
  165.     ui.removeTextArea(59)
  166.     ui.removeTextArea(60)
  167.     ui.removeTextArea(53)
  168.     ui.removeTextArea(51)
  169.     ui.removeTextArea(54)
  170.     ui.addTextArea(56, "<p align='center'><font face='Century Gothic'><a href='event:azart'><font size='12'>Azar", ADMINISTRADOR, 601, 246, 55, 18, 0x324650, 0x324650, 1, true)
  171.  
  172.    
  173.     verificarmodo2()
  174.     end
  175.  
  176. function eventPlayerWon(player)
  177.     if not isfirst then
  178.         isfirst = true
  179.         tfm.exec.setGameTime(3)
  180.         if modo2b == "Deathmatch" then
  181.             if puntos[player] >= WINS - 1 then
  182.                 gameRunning = false
  183.                 winTime = os.time()
  184.                 ui.addTextArea(29, string.format("<p align='center'><font face='Century Gothic'><font size='37' color='#000000'>%s ganó", player), nil, 3, 168, 800, 500, 0, 0, 0, true)
  185.                 ui.addTextArea(30, string.format("<p align='center'><font face='Century Gothic'><font size='37'><font color='#cecece'><font color='#ff0000'>%s </font>ganó", player), nil, 1, 170, 800, 500, 0, 0, 0, true)
  186.                  ui.addTextArea(16, "<p align='center'><font color='#225066' size='18' face='Impact'><a href='event:iniciarJogo'>DE NUEVO", ADMINISTRADOR, 350, 270, 100, 20, 0xFFFFFF, 0xFFFFFF, 1, true)
  187.             end
  188.                 tfm.exec.setGameTime(3)
  189.                 puntos[player] = puntos[player]+1
  190.                 equipoc[player] = "0x115b17"
  191.                 displayScoreDeathmatch()
  192.         end
  193.     if modo2b == "burlas" then
  194.         if table.contains(teams[1], player) then
  195.             tfm.exec.setGameTime(3)
  196.             points[1] = points[1]+1
  197.             ui.addTextArea(100, "<p align='center'><font size='20' color='#FF0000'><font face='Century Gothic'>¡" ..player  .." <font color='#ffffff'><font face='Century Gothic'>se ha llevado el punto!</font>", nil, 6, 70, 790, 100, 0x324650, 0x000000, 0, true)
  198.         elseif table.contains(teams[2], player) then
  199.             tfm.exec.setGameTime(3)
  200.             points[2] = points[2]+1
  201.             ui.addTextArea(100, "<p align='center'><font size='20' color='#003AFF'><font face='Century Gothic'>¡" ..player  .." <font color='#ffffff'>se ha llevado el punto!</font>", nil, 6, 70, 790, 100, 0x324650, 0x000000, 0, true)
  202.         elseif table.contains(teams[3], player) then
  203.             tfm.exec.setGameTime(3)
  204.             points[3] = points[3]+1
  205.             ui.addTextArea(100, "<p align='center'><font size='20' color='#00FF04'><font face='Century Gothic'>¡" ..player  .." <font color='#ffffff'>se ha llevado el punto!</font>", nil, 6, 70, 790, 100, 0x324650, 0x000000, 0, true)
  206.         elseif table.contains(teams[4], player) then
  207.             tfm.exec.setGameTime(3)
  208.             points[4] = points[4]+1
  209.             ui.addTextArea(100, "<p align='center'><font size='20' color='#FF9E00'><font face='Century Gothic'>¡" ..player  .." <font color='#ffffff'>se ha llevado el punto!</font>", nil, 6, 70, 790, 100, 0x324650, 0x000000, 0, true)
  210.         elseif table.contains(teams[5], player) then
  211.             tfm.exec.setGameTime(3)
  212.             points[5] = points[5]+1
  213.             ui.addTextArea(100, "<p align='center'><font size='20' color='#FBFF00'><font face='Century Gothic'>¡" ..player  .." <font color='#ffffff'>se ha llevado el punto!</font>", nil, 6, 70, 790, 100, 0x324650, 0x000000, 0, true)
  214.         elseif table.contains(teams[6], player) then
  215.             tfm.exec.setGameTime(3)
  216.             points[6] = points[6]+1
  217.             ui.addTextArea(100, "<p align='center'><font size='20' color='#AE00FF'><font face='Century Gothic'>¡" ..player  .." <font color='#ffffff'>se ha llevado el punto!</font>", nil, 6, 70, 790, 100, 0x324650, 0x000000, 0, true)
  218.         elseif table.contains(teams[7], player) then
  219.             tfm.exec.setGameTime(3)
  220.             points[7] = points[7]+1
  221.             ui.addTextArea(100, "<p align='center'><font size='20' color='#FF0097'><font face='Century Gothic'>¡" ..player  .." <font color='#ffffff'>se ha llevado el punto!</font>", nil, 6, 70, 790, 100, 0x324650, 0x000000, 0, true)
  222.         elseif table.contains(teams[8], player) then
  223.             tfm.exec.setGameTime(3)
  224.             points[8] = points[8]+1
  225.             ui.addTextArea(100, "<p align='center'><font size='20' color='#060606'><font face='Century Gothic'>¡" ..player  .." <font color='#ffffff'>se ha llevado el punto!</font>", nil, 6, 70, 790, 100, 0x324650, 0x000000, 0, true)
  226.         else
  227.             isfirst = false
  228.         end
  229.         winner = false
  230.         if points[1] >= WINS then
  231.             winner = 1
  232.         elseif points[2] >= WINS then
  233.             winner = 2
  234.         elseif points[3] >= WINS then
  235.             winner = 3
  236.         elseif points[4] >= WINS then
  237.             winner = 4
  238.         elseif points[5] >= WINS then
  239.             winner = 5
  240.          elseif points[6] >= WINS then
  241.             winner = 6
  242.         elseif points[7] >= WINS then
  243.             winner = 7
  244.         elseif points[8] >= WINS then
  245.             winner = 8
  246.         end
  247.         if winner then
  248.             gameRunning = false
  249.             winTime = os.time()
  250.             local names = {
  251.                 "rojo",
  252.                 "azul",
  253.                 "verde",
  254.                 "naranja",
  255.                 "amarillo",
  256.                 "morado",
  257.                 "rosado",
  258.                 "negro",
  259.             }
  260.             ui.addTextArea(26, string.format("<p align='center'><font face='Century Gothic'><font size='37' color='#000000'>El equipo %s ganó", names[winner]), nil, 0, 171, 800, 500, 0, 0, 0, true)
  261.             ui.addTextArea(27, string.format("<p align='center'><font face='Century Gothic'><font size='37' color='#000000'>El equipo %s ganó", names[winner]), nil, 1, 170, 800, 500, 0, 0, 0, true)
  262.             ui.addTextArea(28, string.format("<p align='center'><font face='Century Gothic'><font size='37' color='#000000'>El equipo %s ganó", names[winner]), nil, 2, 169, 800, 500, 0, 0, 0, true)
  263.             ui.addTextArea(29, string.format("<p align='center'><font face='Century Gothic'><font size='37' color='#000000'>El equipo %s ganó", names[winner]), nil, 3, 168, 800, 500, 0, 0, 0, true)
  264.             ui.addTextArea(30, string.format("<p align='center'><font face='Century Gothic'><font size='37'><font color='#cecece'>El equipo <font color='#%s'>%s</font> ganó", colors[winner], names[winner]), nil, 1, 170, 800, 500, 0, 0, 0, true)
  265.             ui.addTextArea(16, "<p align='center'><font color='#225066' size='15' face='Century Gothic'><a href='event:iniciarJogo'>REVANCHA", ADMINISTRADOR, 350, 270, 100, 20, 0xFFFFFF, 0xFFFFFF, 1, true)
  266.         end
  267.         displayScore()
  268.         end
  269.     end
  270. end
  271. function eventLoop(elapsed, remain)
  272.     if gameRunning then
  273.         remain = remain/1000
  274.         if remain < 0 then
  275.             remain = 100
  276.             newMap()
  277.         end
  278.     else
  279.         if winTime then
  280.             if winTime > os.time()-30000 then
  281.             else
  282.                 winTime = false
  283.                 ui.removeTextArea(26)
  284.                 ui.removeTextArea(27)
  285.                 ui.removeTextArea(28)
  286.                 ui.removeTextArea(29)
  287.                 ui.removeTextArea(30)
  288.                 displayTeams()
  289.                 teams = {
  290.                     [1] = {},
  291.                     [2] = {},
  292.                     [3] = {},
  293.                     [4] = {},
  294.                     [5] = {},
  295.                     [6] = {},
  296.                     [7] = {},
  297.                     [8] = {},
  298.                 }
  299.                 points = {
  300.                     [1] = {},
  301.                     [2] = {},
  302.                     [3] = {},
  303.                     [4] = {},
  304.                     [5] = {},
  305.                     [6] = {},
  306.                     [7] = {},
  307.                     [8] = {},
  308.                 }
  309.                 playersInGame = {}
  310.             end
  311.         end
  312.     end
  313. end
  314. function string.title(s)
  315.     return string.gsub(s, "%a", function(c)
  316.         return string.upper(c)
  317.     end, 1)
  318. end
  319. function resetmostrarjugadoresdeathmatch()
  320. distanciax = 30
  321. distanciay = 80
  322. textarealugar = 302
  323. textareaid = 0
  324. end
  325. function eventChatCommand(player, command)
  326.     if modo2b == "Deathmatch" then
  327.         args = string.split(command, " ")
  328.         if args[1] == "puntaje" then
  329.             resetmostrarjugadoresdeathmatch()
  330.             ui.addTextArea(300, "<p align='center'><V><a href='event:cerrarpuntaje'>X", player, 30, 50, 30, 16, 0x324650, 0x324650, 1, true)
  331.             ui.addTextArea(301, string.format("<p align='center'><V>Todos a %s puntos",WINS), player, 80, 45, 180, 18, 0x324650, 0x000000, 1, true)
  332.             for k,players in pairs(tfm.get.room.playerList) do
  333.                 if puntos[k] then
  334.                     equipos[k] = k
  335.                     playersInGame[k] = true
  336.                     if textareaid >= 32 then
  337.                     else
  338.                         ui.addTextArea(textarealugar, string.format("<p align='center'><V>%s - %s",k,puntos[k]), player, distanciax, distanciay, 140, 18, 0x324650, 0x000000, 1, true)
  339.                         distanciay = distanciay + 37
  340.                         textareaid = textareaid + 1
  341.                         textarealugar = textarealugar + 1
  342.                         if textareaid == 8 then
  343.                             distanciax = distanciax + 190
  344.                             distanciay = 80
  345.                             textareaid = 0
  346.                         end
  347.                     end
  348.                 end
  349.             end
  350.         end
  351.     end
  352.     if player:lower() == ADMINISTRADOR:lower() then
  353.         args = string.split(command, " ")
  354.         if args[1] == "team1" then
  355.             if modo2b == "burlas" then
  356.                 table.remove(args, 1)
  357.                 teams[1] = {}
  358.                 points[1] = 0
  359.                 for index, player in pairs(args) do
  360.                     player = string.title(player)
  361.                     table.insert(teams[1], player)
  362.                     playersInGame[player] = true
  363.                 end
  364.             if modoazar == "true" then
  365.             modoalazar()
  366.             else
  367.             displayTeams()
  368.             end
  369.             end
  370.         elseif args[1] == "team2" and modo2b == "burlas" then
  371.             table.remove(args, 1)
  372.             teams[2] = {}
  373.             points[2] = 0
  374.             for index, player in pairs(args) do
  375.                 player = string.title(player)
  376.                 table.insert(teams[2], player)
  377.                 playersInGame[player] = true
  378.             end
  379.             if modoazar == "true" then
  380.             modoalazar()
  381.             else
  382.             displayTeams()
  383.             end
  384.         elseif args[1] == "team3" and modo2b == "burlas" then
  385.             table.remove(args, 1)
  386.             teams[3] = {}
  387.             points[3] = 0
  388.             for index, player in pairs(args) do
  389.                 player = string.title(player)
  390.                 table.insert(teams[3], player)
  391.                 playersInGame[player] = true
  392.             end
  393.             if modoazar == "true" then
  394.             modoalazar()
  395.             else
  396.             displayTeams()
  397.             end
  398.         elseif args[1] == "team4" and modo2b == "burlas" then
  399.             table.remove(args, 1)
  400.             teams[4] = {}
  401.             points[4] = 0
  402.             for index, player in pairs(args) do
  403.                 player = string.title(player)
  404.                 table.insert(teams[4], player)
  405.                 playersInGame[player] = true
  406.             end
  407.                         if modoazar == "true" then
  408.             modoalazar()
  409.             else
  410.             displayTeams()
  411.             end
  412.                 elseif args[1] == "team5" and modo2b == "burlas" then
  413.             table.remove(args, 1)
  414.             teams[5] = {}
  415.             points[5] = 0
  416.             for index, player in pairs(args) do
  417.                 player = string.title(player)
  418.                 table.insert(teams[5], player)
  419.                 playersInGame[player] = true
  420.             end
  421.                         if modoazar == "true" then
  422.             modoalazar()
  423.             else
  424.             displayTeams()
  425.             end
  426.            
  427.         elseif args[1] == "team6" and modo2b == "burlas" then
  428.             table.remove(args, 1)
  429.             teams[6] = {}
  430.             points[6] = 0
  431.             for index, player in pairs(args) do
  432.                 player = string.title(player)
  433.                 table.insert(teams[6], player)
  434.                 playersInGame[player] = true
  435.             end
  436.                         if modoazar == "true" then
  437.             modoalazar()
  438.             else
  439.             displayTeams()
  440.             end
  441.            
  442.                 elseif args[1] == "team7" and modo2b == "burlas" then
  443.             table.remove(args, 1)
  444.             teams[7] = {}
  445.             points[7] = 0
  446.             for index, player in pairs(args) do
  447.                 player = string.title(player)
  448.                 table.insert(teams[7], player)
  449.                 playersInGame[player] = true
  450.             end
  451.                         if modoazar == "true" then
  452.             modoalazar()
  453.             else
  454.             displayTeams()
  455.             end
  456.             elseif args[1] == "team8" and modo2b == "burlas" then
  457.             table.remove(args, 1)
  458.             teams[8] = {}
  459.             points[8] = 0
  460.             for index, player in pairs(args) do
  461.                 player = string.title(player)
  462.                 table.insert(teams[8], player)
  463.                 playersInGame[player] = true
  464.             end
  465.             if modoazar == "true" then
  466.             modoalazar()
  467.             else
  468.             displayTeams()
  469.             end
  470.         elseif args[1] == "saltar" then
  471.             newMap()
  472.         elseif args[1] == "np" then
  473.             if args[2] then
  474.                 table.insert(queue, args[2])
  475.             end
  476.         elseif args[1] == "resultado" then
  477.             if args[2] then
  478.                 WINS = tonumber(args[2])
  479.                 displayScore()
  480.             end
  481.         elseif args[1] == "añadir" and modo2b == "Deathmatch" then
  482.             if args[2] then
  483.                 table.remove(args, 1)
  484.                 for index, player in pairs(args) do
  485.                 equipos[player] = player
  486.                 puntos[player] = 0
  487.                 playersInGame[player] = true
  488.                 end
  489.             end
  490.         elseif args[1] == "añadir" and modo2b == "burlas" then
  491.             if args[2] and args[3] then
  492.                 if args[2] == "team1" and modo2b == "burlas" then
  493.                     table.remove(args, 1)
  494.                     table.remove(args, 1)
  495.                     for index, player in pairs(args) do
  496.                         player = string.title(player)
  497.                         table.insert(teams[1], player)
  498.                         playersInGame[player] = true
  499.                     end
  500.                 end
  501.                 if args[2] == "team2" and modo2b == "burlas" then
  502.                     table.remove(args, 1)
  503.                     table.remove(args, 1)
  504.                     for index, player in pairs(args, 3) do
  505.                         player = string.title(player)
  506.                         table.insert(teams[2], player)
  507.                         playersInGame[player] = true
  508.                     end
  509.                 end
  510.                 if args[2] == "team3" and modo2b == "burlas" then
  511.                     table.remove(args, 1)
  512.                     table.remove(args, 1)
  513.                     for index, player in pairs(args) do
  514.                         player = string.title(player)
  515.                         table.insert(teams[3], player)
  516.                         playersInGame[player] = true
  517.                     end
  518.                 end
  519.                 if args[2] == "team4" and modo2b == "burlas" then
  520.                     table.remove(args, 1)
  521.                     table.remove(args, 1)
  522.                     for index, player in pairs(args) do
  523.                         player = string.title(player)
  524.                         table.insert(teams[4], player)
  525.                         playersInGame[player] = true
  526.                     end
  527.                 end
  528.                 if args[2] == "team5" and modo2b == "burlas" then
  529.                     table.remove(args, 1)
  530.                     table.remove(args, 1)
  531.                     for index, player in pairs(args) do
  532.                         player = string.title(player)
  533.                         table.insert(teams[5], player)
  534.                         playersInGame[player] = true
  535.                     end
  536.                 end
  537.                 if args[2] == "team6" and modo2b == "burlas" then
  538.                     table.remove(args, 1)
  539.                     table.remove(args, 1)
  540.                     for index, player in pairs(args) do
  541.                         player = string.title(player)
  542.                         table.insert(teams[6], player)
  543.                         playersInGame[player] = true
  544.                     end
  545.                 end
  546.                 if args[2] == "team7" and modo2b == "burlas" then
  547.                     table.remove(args, 1)
  548.                     table.remove(args, 1)
  549.                     for index, player in pairs(args) do
  550.                         player = string.title(player)
  551.                         table.insert(teams[7], player)
  552.                         playersInGame[player] = true
  553.                     end
  554.                 end
  555.                 if args[2] == "team8" and modo2b == "burlas" then
  556.                     table.remove(args, 1)
  557.                     table.remove(args, 1)
  558.                     for index, player in pairs(args) do
  559.                         player = string.title(player)
  560.                         table.insert(teams[8], player)
  561.                         playersInGame[player] = true
  562.                     end
  563.                 end
  564.             end
  565.         elseif args[1] == "quitar" then
  566.             if args[2] then
  567.                     for index, player in pairs(args) do
  568.                         player = string.title(player)
  569.                         playersInGame[player] = false
  570.                     end
  571.             end
  572.         elseif args[1] == "reiniciar" then
  573.             teams[1] = {}
  574.             points[1] = 0
  575.             teams[2] = {}
  576.             points[2] = 0
  577.             teams[3] = {}
  578.             points[3] = 0
  579.             teams[4] = {}
  580.             points[4] = 0
  581.             teams[5] = {}
  582.             points[5] = 0
  583.             teams[6] = {}
  584.             points[6] = 0
  585.             teams[7] = {}
  586.             points[7] = 0
  587.             teams[8] = {}
  588.             points[8] = 0
  589.             equipos = {}
  590.             puntos = {}
  591.             modob = "racing"
  592.             modo = "bootcamp"
  593.             modo2 = "Deathmatch"
  594.             modo2b = "burlas"
  595.             displayTeams()
  596.            
  597.            
  598.         elseif args[1] == "puntos" and modo2b == "burlas" then
  599.             if args[2] and args[3] then
  600.                 local team = tonumber(args[2]:match("team(%d+)") or 0)
  601.                 if team > 0 and team < 5 then
  602.                     local newScore = tonumber(args[3]) or points[team]
  603.                     points[team] = newScore
  604.                     displayScore()
  605.                 end
  606.             end
  607.         elseif args[1] == "pausar" then
  608.             gameRunning = not gameRunning
  609.             if not gameRunning then
  610.                 ui.addTextArea(90, "", nil, 235, 200, 302, 22, 0x324650, 0x5A7A8B, 1, true)
  611.                 ui.addTextArea(91, "<p align='center'><font face='Century Gothic'> El juego ha sido pausado  ", nil, 235, 200, 300, 20, 0x324650, 0x324650, 1, true)
  612.                 tfm.exec.disableAutoTimeLeft(true)
  613.             else
  614.                 ui.removeTextArea(90)
  615.                 ui.removeTextArea(91)
  616.                 tfm.exec.disableAutoTimeLeft(false)
  617.             end
  618.         end
  619.     end
  620. end
  621. function eventNewGame()
  622.     if gameRunning then
  623.         tfm.exec.setUIMapName("")
  624.         if modo2b == "burlas" then
  625.             isfirst = false
  626.             for i, p in pairs(teams[1]) do
  627.                 tfm.exec.setNameColor(p, "0x"..colors[1])
  628.             end
  629.             for i, p in pairs(teams[2]) do
  630.                 tfm.exec.setNameColor(p, "0x"..colors[2])
  631.             end
  632.             for i, p in pairs(teams[3]) do
  633.                 tfm.exec.setNameColor(p, "0x"..colors[3])
  634.             end
  635.             for i, p in pairs(teams[4]) do
  636.                 tfm.exec.setNameColor(p, "0x"..colors[4])
  637.             end
  638.             for i, p in pairs(teams[5]) do
  639.                 tfm.exec.setNameColor(p, "0x"..colors[5])
  640.             end
  641.             for i, p in pairs(teams[6]) do
  642.                 tfm.exec.setNameColor(p, "0x"..colors[6])
  643.             end
  644.             for i, p in pairs(teams[7]) do
  645.                 tfm.exec.setNameColor(p, "0x"..colors[7])
  646.             end
  647.             for i, p in pairs(teams[8]) do
  648.                 tfm.exec.setNameColor(p, "0x"..colors[8])
  649.             end
  650.             displayScore()
  651.         end
  652.         if modo2b == "Deathmatch" then
  653.             isfirst = false
  654.             for k,players in pairs(tfm.get.room.playerList) do
  655.                 tfm.exec.setNameColor(k, "0xff0000")
  656.                 equipoc[k] = "0x324650"
  657.             end
  658.             displayScore()
  659.         end
  660.     end
  661. end
  662. function displayScore()
  663.     if modo2b == "burlas" then
  664.         if modoazar == "true" then
  665.             ui.addTextArea(25, string.format("<p align='center'><font size='20'><font color='#%s'>%s<N> - <font color='#%s'>%s <N> (Ganar) <font color='#111111'>%s", colors[1], points[1], colors[2], points[2], WINS), nil, 0, 22, 800, 30, 0, 0, 0, true)
  666.         end
  667.         if modoazar == "false" then
  668.             ui.addTextArea(25, string.format("<p align='center'><font size='20'><font color='#%s'>%s<N> - <font color='#%s'>%s <N> - <font color='#%s'>%s <N> - <font color='#%s'>%s <N> - <font color='#%s'>%s <N> - <font color='#%s'>%s <N> - <font color='#%s'>%s <N> - <font color='#%s'>%s <N> (Ganar) <font color='#111111'>%s", colors[1], points[1], colors[2], points[2], colors[3], points[3], colors[4], points[4], colors[5], points[5], colors[6], points[6], colors[7], points[7], colors[8], points[8], WINS), nil, 0, 22, 800, 30, 0, 0, 0, true)
  669.         end
  670.     end
  671. end
  672. function displayScoreDeathmatch()
  673. resetmostrarjugadoresdeathmatch()
  674. ui.addTextArea(300, string.format("<p align='center'><font face='Century Gothic'>Competitivo a %s puntos",WINS), nil, 80, 45, 180, 18, 0x324650, 0x000000, 1, true)
  675. for k,players in pairs(tfm.get.room.playerList) do
  676.         if puntos[k] then
  677.             equipos[k] = k
  678.             playersInGame[k] = true
  679.                 if textareaid >= 32 then
  680.                 else
  681.                     ui.addTextArea(textarealugar, string.format("<p align='center'><V>%s - %s",k,puntos[k]), nil, distanciax, distanciay, 140, 18, equipoc[k], 0x000000, 1, true)
  682.                     distanciay = distanciay + 37
  683.                     textareaid = textareaid + 1
  684.                     textarealugar = textarealugar + 1
  685.                     if textareaid == 8 then
  686.                         distanciax = distanciax + 190
  687.                         distanciay = 80
  688.                         textareaid = 0
  689.                 end
  690.             end
  691.         end
  692.     end
  693. end
  694. function borrarScoreDeathmatch()
  695. for i = 300, 334 do
  696.             ui.removeTextArea(i)
  697.         end
  698. end
  699. system.bindMouse("+Lknx#0000", true)
  700. function eventMouse(name, x, y)
  701.     tfm.exec.movePlayer(name,x,y,false,0,0,true)
  702. end
  703. function displayTeams()
  704.     borrarScoreDeathmatch()
  705.     modoazar = "false"
  706.     ui.addTextArea(38, "", nil, 235, 30, 302, 22, 0x324650, 0x5A7A8B, 1, true)
  707.     ui.addTextArea(37, "<p align='center'><font face='Century Gothic'><font size='12'>Administrador: "..ADMINISTRADOR, nil, 235, 30, 300, 20, 0x324650, 0x324650, 1, true)
  708.     ui.addTextArea(2, "", nil, 0, 71, 800, 295, 0x0E1417, 0x0E1417, 1, true)
  709.     ui.addTextArea(4, "", nil, 57, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  710.     ui.addTextArea(5, "<p align='center'><font face='Century Gothic'><font size='13'>Equipo 1", nil, 58, 80, 140, 20, 0x324650, 0x324650, 1, true)
  711.     ui.addTextArea(6, "", nil, 227, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  712.     ui.addTextArea(7, "<p align='center'><font face='Century Gothic'><font size='13'>Equipo 2", nil, 228, 80, 140, 20, 0x324650, 0x324650, 1, true)
  713.     ui.addTextArea(8, "", nil, 417, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  714.     ui.addTextArea(9, "<p align='center'><font face='Century Gothic'><font size='13'>Equipo 3", nil, 418, 80, 140, 20, 0x324650, 0x324650, 1, true)
  715.     ui.addTextArea(10, "", nil, 587, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  716.     ui.addTextArea(11, "<p align='center'><font face='Century Gothic'><font size='13'>Equipo 4", nil, 588, 80, 140, 20, 0x324650, 0x324650, 1, true)
  717.     ui.addTextArea(73, "", nil, 57, 229, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  718.     ui.addTextArea(68, "<p align='center'><font face='Century Gothic'><font size='13'>Equipo 5", nil, 58, 230, 140, 20, 0x324650, 0x324650, 1, true)
  719.     ui.addTextArea(69, "", nil, 227, 229, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  720.     ui.addTextArea(70, "<p align='center'><font face='Century Gothic'><font size='13'>Equipo 6", nil, 228, 230, 140, 20, 0x324650, 0x324650, 1, true)
  721.     ui.addTextArea(71, "", nil, 417, 229, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  722.     ui.addTextArea(72, "<p align='center'><font face='Century Gothic'><font size='13'>Equipo 7", nil, 418, 230, 140, 20, 0x324650, 0x324650, 1, true)
  723.     ui.addTextArea(77, "", nil, 587, 229, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  724.     ui.addTextArea(74, "<p align='center'><font face='Century Gothic'><font size='13'>Equipo 8", nil, 588, 230, 140, 20, 0x324650, 0x324650, 1, true)
  725.  
  726. ui.addTextArea(12, "<p align='center'><font color='#5A7A8B'>|</font>", nil, 210, 102, 140, 200, 0, 0, 0, true)
  727.     ui.addTextArea(39, "<p align='center'><font color='#5A7A8B'>|</font>", nil, 450, 102, 140, 200, 0, 0, 0, true)
  728.     ui.addTextArea(40, "", nil, 59, 120, 140, 92, 0x5A7A8B, 0x5A7A8B, 1, true)
  729.     ui.addTextArea(31, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 60, 121, 138, 90, 0x324650, 0x324650, 1, true)
  730.     ui.addTextArea(32, "", nil, 419, 120, 140, 92, 0x5A7A8B, 0x5A7A8B, 1, true)
  731.     ui.addTextArea(33, "<p align='center'><font color='#"..colors[3].."'>"..table.concat(teams[3], "\n"), nil, 420, 121, 138, 90, 0x324650, 0x324650, 1, true)
  732.     ui.addTextArea(34, "", nil, 589, 120, 140, 92, 0x5A7A8B, 0x5A7A8B, 1, true)
  733.     ui.addTextArea(35, "<p align='center'><font color='#"..colors[4].."'>"..table.concat(teams[4], "\n"), nil, 590, 121, 138, 90, 0x324650, 0x324650, 1, true)
  734.     ui.addTextArea(36, "", nil, 229, 120, 140, 92, 0x5A7A8B, 0x5A7A8B, 1, true)
  735.     ui.addTextArea(13, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 230, 121, 138, 90, 0x324650, 0x324650, 1, true)
  736.     ui.addTextArea(76, "", nil, 59, 269, 140, 92, 0x5A7A8B, 0x5A7A8B, 1, true)
  737.     ui.addTextArea(62, "<p align='center'><font color='#"..colors[5].."'>"..table.concat(teams[5], "\n"), nil, 60, 270, 138, 90, 0x324650, 0x324650, 1, true)
  738.     ui.addTextArea(63, "", nil, 419, 269, 140, 92, 0x5A7A8B, 0x5A7A8B, 1, true)
  739.     ui.addTextArea(64, "<p align='center'><font color='#"..colors[7].."'>"..table.concat(teams[7], "\n"), nil, 420, 270, 138, 90, 0x324650, 0x324650, 1, true)
  740.     ui.addTextArea(65, "", nil, 589, 269, 140, 92, 0x5A7A8B, 0x5A7A8B, 1, true)
  741.     ui.addTextArea(66, "<p align='center'><font color='#"..colors[8].."'>"..table.concat(teams[8], "\n"), nil, 590, 270, 138, 90, 0x324650, 0x324650, 1, true)
  742.     ui.addTextArea(67, "", nil, 229, 269, 140, 92, 0x5A7A8B, 0x5A7A8B, 1, true)
  743.     ui.addTextArea(75, "<p align='center'><font color='#"..colors[6].."'>"..table.concat(teams[6], "\n"), nil, 230, 270, 138, 90, 0x324650, 0x324650, 1, true)
  744.     ui.addTextArea(14, "<p align='center'><font color='#5A7A8B'>____         ____</font>", nil, 325, 206, 140, 200, 0, 0, 0, true)
  745.     ui.addTextArea(15, "", nil, 374, 211, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  746.     ui.addTextArea(16, "<p align='center'><font face='Century Gothic'>VS", nil, 375, 212, 38, 18, 0x324650, 0x324650, 1, true)
  747.     ui.addTextArea(42, "", ADMINISTRADOR, 749, 81, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  748.     ui.addTextArea(41, "<p align='center'><font face='Century Gothic'><a href='event:salir'>X", ADMINISTRADOR, 750, 82, 38, 18, 0x324650, 0x324650, 1, true)
  749.     ui.addTextArea(45, "", ADMINISTRADOR, 744, 139, 52, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  750.     ui.addTextArea(46, "<p align='center'><font face='Century Gothic'><a href='event:reset'>Reiniciar", ADMINISTRADOR, 745, 140, 50, 18, 0x324650, 0x324650, 1, true)
  751.     ui.addTextArea(47, "", ADMINISTRADOR, 741, 173, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  752.     ui.addTextArea(54, "", ADMINISTRADOR, 741, 209, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  753.     if modo2 == "Deathmatch" then
  754.     ui.addTextArea(51, "<p align='center'><font face='Century Gothic'><a href='event:Deathmatch'><font size='12'>"..modo2, ADMINISTRADOR, 742, 210, 55, 18, 0x324650, 0x324650, 1, true)
  755.     end
  756.     verificarmodo()
  757.     ui.addTextArea(53, "", ADMINISTRADOR, 741, 245, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  758.     ui.addTextArea(56, "<p align='center'><font face='Century Gothic'><a href='event:llenar'><font size='12'>Llenar", ADMINISTRADOR, 742, 246, 55, 18, 0x324650, 0x324650, 1, true)
  759.     ui.addTextArea(16, "<p align='center'><font face='Century Gothic'><a href='event:iniciarJogo'>Inicia", ADMINISTRADOR, 375, 212, 38, 18, 0x324650, 0x324650, 1, true)
  760.     ui.addTextArea(57, "", ADMINISTRADOR, 741, 281, 57, 25, 0x5A7A8B, 0x5A7A8B, 1, true)
  761.     ui.addTextArea(58, "<p align='center'><font face='Century Gothic'><a href='event:azart'><font size='12'>", ADMINISTRADOR, 742, 282, 55, 23, 0x324650, 0x324650, 1, true)
  762.     ui.addTextArea(59, "<p align='center'><font face='Century Gothic'><a href='event:azart'><font size='12'>teams", ADMINISTRADOR, 742, 290, 55, 23, 0x000000, 0x000000, 1, true)
  763.     ui.addTextArea(60, "<p align='center'><font face='Century Gothic'><a href='event:azart'><font size='12'>Azar 2", ADMINISTRADOR, 742, 278, 55, 23, 0x000000, 0x000000, 1, true)
  764. end
  765. function verificarmodo()
  766.  ui.addTextArea(50, string.format("<p align='center'><font face='Century Gothic'><font size='11'>Modo %s - %s ",modob,modo2b),nil, 235, 375, 300, 17, 0x324650, 0x324650, 1, true)
  767.  if modo2 == "burlas" then
  768.     ui.addTextArea(51, "<p align='center'><font face='Century Gothic'><a href='event:burlas'><font size='12'>"..modo2, ADMINISTRADOR, 742, 210, 55, 18, 0x324650, 0x324650, 1, true)
  769.     end
  770.     if modo == "bootcamp" then
  771.     ui.addTextArea(48, "<p align='center'><font face='Century Gothic'><a href='event:bootcamp'><font size='12'>"..modo, ADMINISTRADOR, 742, 174, 55, 18, 0x324650, 0x324650, 1, true)
  772.     end
  773.     if modo == "racing" then
  774.     ui.addTextArea(48, "<p align='center'><font face='Century Gothic'><a href='event:racing'><font size='12'>"..modo, ADMINISTRADOR, 742, 174, 55, 18, 0x324650, 0x324650, 1, true)
  775.     end
  776.     if modo == "mix" then
  777.     ui.addTextArea(48, "<p align='center'><font face='Century Gothic'><a href='event:mix'><font size='12'>"..modo, ADMINISTRADOR, 742, 174, 55, 18, 0x324650, 0x324650, 1, true)
  778.     end
  779. end
  780. function contarjugadores()
  781.         local players=0
  782.         function eventNewPlayer(name)--Cuando un jugador entre a la sala...
  783.             players=players+1--Sumamos 1 a nuestra tabla
  784.         end
  785.         function eventPlayerLeft(name)--Cuando un jugador salga de la sala...
  786.             players=players-1--Restamos 1 a nuestra tabla
  787.         end
  788.         for name in pairs(tfm.get.room.playerList) do--Por cada jugador que esté en la sala...
  789.             eventNewPlayer(name)--Le ejecutamos la función eventNewPlayer
  790.         end
  791. end
  792. function eventTextAreaCallback(id, player, callback)
  793.     if callback == 'iniciarJogo' then
  794.             gameRunning = true
  795.             for i = 1, 20 do
  796.                 ui.removeTextArea(i)
  797.             end
  798.             for i = 26, 77 do
  799.                 ui.removeTextArea(i)
  800.             end
  801.     borrarScoreDeathmatch()
  802.             newMap()
  803.             if modo2b == "burlas" then
  804.                 points[1] = 0
  805.                 points[2] = 0
  806.                 points[3] = 0
  807.                 points[4] = 0
  808.                 points[5] = 0
  809.                 points[6] = 0
  810.                 points[7] = 0
  811.                 points[8] = 0
  812.                 displayScore()
  813.             end
  814.             if modo2b == "Deathmatch" then
  815.                 for k,v in pairs(tfm.get.room.playerList) do
  816.                 puntos[k] = 0
  817.                 end
  818.             end
  819.     end
  820.     if callback == 'salir' then
  821.         tfm.system.exit()
  822.     end
  823.  
  824.     if callback == 'llenar' then
  825.     nteam = 1
  826.         azar = {}
  827.         playersInGame = {}
  828.        
  829.         teams = {
  830.             [1] = {},
  831.             [2] = {},
  832.             [3] = {},
  833.             [4] = {},
  834.             [5] = {},
  835.             [6] = {},
  836.             [7] = {},
  837.             [8] = {},
  838.         }  
  839.         contarjugadores()
  840.         for k,players in pairs(tfm.get.room.playerList) do
  841.             if nteam > 8 then
  842.                 nteam = 1
  843.             end
  844.                 table.insert(teams[nteam], k)
  845.                 playersInGame[k] = true
  846.                 nteam = nteam + 1
  847.                 displayTeams()
  848.         end
  849.     end
  850.    
  851.    
  852.    
  853.     if callback == 'reiniciar' then
  854.             teams[1] = {}
  855.             points[1] = 0
  856.             teams[2] = {}
  857.             points[2] = 0
  858.             teams[3] = {}
  859.             points[3] = 0
  860.             teams[4] = {}
  861.             points[4] = 0
  862.             teams[5] = {}
  863.             points[5] = 0
  864.             teams[6] = {}
  865.             points[6] = 0
  866.             teams[7] = {}
  867.             points[7] = 0
  868.             teams[8] = {}
  869.             points[8] = 0
  870.             equipos = {}
  871.             puntos = {}
  872.             modob = "racing"
  873.             modo = "bootcamp"
  874.             modo2 = "Deathmatch"
  875.             modo2b = "burlas"
  876.             displayTeams()
  877.            
  878.     end
  879.     if callback == 'bootcamp' then
  880.         tiempo = 150
  881.         modob = "bootcamp"
  882.         modo = "mix"
  883.         verificarmodo()
  884.         maps = mapasbootcamp
  885.     end
  886.     if callback == 'racing' then
  887.  
  888.         tiempo = 60
  889.         modob = "racing"
  890.         modo = "bootcamp"
  891.         verificarmodo()
  892.         maps = mapasracing
  893.     end
  894.     if callback == 'mix' then
  895.         tiempo = 90
  896.         modob = "mix"
  897.         modo = "racing"
  898.         verificarmodo()
  899.         maps = mapasmix
  900.     end
  901.     if callback == 'Deathmatch' then
  902.        modo2b = "Deathmatch"
  903.         modo2 = "burlas"
  904.         displayTeams()
  905.         for i = 4, 15 do
  906.             ui.removeTextArea(i)
  907.         end
  908.         for i = 31, 36 do
  909.             ui.removeTextArea(i)
  910.         end
  911.         for i = 39, 40 do
  912.             ui.removeTextArea(i)
  913.         end
  914.         ui.removeTextArea(53)
  915.         ui.removeTextArea(56)
  916.         contarjugadores()
  917.     for k,players in pairs(tfm.get.room.playerList) do
  918.             equipos[k] = k
  919.             puntos[k] = 0
  920.             equipoc[k] = "0x324650"
  921.             playersInGame[k] = true
  922.             if textareaid >= 32 then
  923.             else
  924.                 ui.addTextArea(textarealugar, "<p align='center'><V>"..k, nil, distanciax, distanciay, 140, 18, 0x324650, 0x324650, 1, true)
  925.                 distanciay = distanciay + 37
  926.                 textareaid = textareaid + 1
  927.                 textarealugar = textarealugar + 1
  928.                 if textareaid == 8 then
  929.                     distanciax = distanciax + 190
  930.                     distanciay = 80
  931.                     textareaid = 0
  932.             end
  933.             ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRADOR, 375, 203, 38, 18, 0x324650, 0x324650, 1, true)
  934.         end
  935.     end
  936.     end
  937.     if callback == 'burlas' then
  938.     modo2b = "burlas"
  939.     modo2 = "Deathmatch"
  940.     resetmostrarjugadoresdeathmatch()
  941.     displayTeams()
  942.     end
  943.     if callback == 'cerrarpuntaje' then
  944.         borrarScoreDeathmatch()
  945.     end
  946.     if callback == 'azart' then
  947.     totales = 0
  948.     totales2 = 0
  949.     jugando = {}
  950.     totaljugando = 1
  951.     jugandoposicion = {}
  952.     playersInGame = {}
  953.     teams[1] = {}
  954.     teams[2] = {}
  955.     teams[3] = {}
  956.     teams[4] = {}
  957.     teams[5] = {}
  958.     teams[6] = {}
  959.     teams[7] = {}
  960.     teams[8] = {}
  961.     alazar()
  962.     borrarScoreDeathmatch()
  963.     modoazar = "true"
  964.     modoalazar()
  965.     end
  966.     if callback == 'volver' then
  967.     totales = 0
  968.     totales2 = 0
  969.     jugando = {}
  970.     totaljugando = 1
  971.     jugandoposicion = {}
  972.     playersInGame = {}
  973.     teams[1] = {}
  974.     teams[2] = {}
  975.     teams[3] = {}
  976.     teams[4] = {}
  977.     teams[5] = {}
  978.     teams[6] = {}
  979.     teams[7] = {}
  980.     teams[8] = {}
  981.     displayTeams()
  982.     end
  983.       if callback == 'bootcamp2' then
  984.         tiempo = 150
  985.         modob = "bootcamp"
  986.         modo = "mix"
  987.         verificarmodo2()
  988.         maps = mapasbootcamp
  989.     end
  990.     if callback == 'racing2' then
  991.  
  992.         tiempo = 60
  993.         modob = "racing"
  994.         modo = "bootcamp"
  995.         verificarmodo2()
  996.         maps = mapasracing
  997.     end
  998.     if callback == 'mix2' then
  999.         tiempo = 90
  1000.         modob = "mix"
  1001.         modo = "racing"
  1002.         verificarmodo2()
  1003.         maps = mapasmix
  1004.     end
  1005. end
  1006. function alazar()
  1007.     t = 0
  1008.     for k,v in pairs(tfm.get.room.playerList) do
  1009.     if t == 1 then
  1010.     table.insert(teams[2], k)
  1011.     playersInGame[k] = true
  1012.     t = 0
  1013.     elseif t == 0 then
  1014.     table.insert(teams[1], k)
  1015.     playersInGame[k] = true
  1016.     t = 1
  1017.     end
  1018.     end
  1019.     end
  1020.  
  1021.  
  1022.  
  1023. function verificarmodo2()
  1024.  ui.addTextArea(50, string.format("<p align='center'><font face='Century Gothic'><font size='11'>Modo %s - %s ",modob,modo2b),nil, 235, 375, 300, 17, 0x324650, 0x324650, 1, true)
  1025.     if modo == "bootcamp" then
  1026.     ui.addTextArea(48, "<p align='center'><font face='Century Gothic'><a href='event:bootcamp2'><font size='12'>"..modo, ADMINISTRADOR, 601, 174, 55, 18, 0x324650, 0x324650, 1, true)
  1027.     end
  1028.     if modo == "racing" then
  1029.     ui.addTextArea(48, "<p align='center'><font face='Century Gothic'><a href='event:racing2'><font size='12'>"..modo, ADMINISTRADOR, 601, 174, 55, 18, 0x324650, 0x324650, 1, true)
  1030.     end
  1031.     if modo == "mix" then
  1032.     ui.addTextArea(48, "<p align='center'><font face='Century Gothic'><a href='event:mix2'><font size='12'>"..modo, ADMINISTRADOR, 601, 174, 55, 18, 0x324650, 0x324650, 1, true)
  1033.     end
  1034. end
  1035. function string.split(s, pattern, n)
  1036.     local st = {}
  1037.     for sb in string.gmatch(s, "[^"..pattern.."]+") do
  1038.     if not n or n > -1 then
  1039.         table.insert(st,sb)
  1040.     else
  1041.         st[#st] = st[#st]..pattern..sb
  1042.     end
  1043.     n = n and n-1 or false
  1044.     end
  1045.     return st
  1046. end
  1047. function table.contains(tableT, element)
  1048.     for _, value in pairs(tableT) do
  1049.         if value == element then
  1050.             return true
  1051.         end
  1052.     end
  1053.     return false
  1054. end
  1055. function eventPlayerDied()
  1056.     local alive = 0
  1057.     for k,v in pairs(tfm.get.room.playerList) do
  1058.         if not v.isDead then
  1059.             alive = alive+1
  1060.         end
  1061.     end
  1062.     if alive == 0 then
  1063.         newMap()
  1064.     end
  1065. end
  1066. displayTeams()
RAW Paste Data