alditojeje

Sorteo

Sep 24th, 2020 (edited)
813
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local verde = "<font color='#00C17c' size='12'>" -- 00C17c cambias eso x el color
  2. local fondoTextAreas = 0x2B2B2B -- color de fondo, ponelo despues del 0x
  3. local bordeTextAreas = 0x121212 -- color del borde
  4.  
  5. local equipos = {{1, "Blood#3565", "Soothsayer#4890", "Benjaneitorc#0000"}, -- 1
  6.             {2, "Misterthepro#0000", "Noob#5388", "Profeteus#0000"},
  7.             {3, "Random#0000", "random2#5388", "random3#0000"},
  8.             {4, "random6#0000", "random5#5388", "random4#0000"},
  9.             {5, "random7#0000", "random8#5388", "random9#0000"},
  10.             {6, "random12#0000", "random11#5388", "random10#0000"},
  11.             {7, "random12#0000", "random11#5388", "random10#0000"},
  12.             {8, "random12#0000", "random11#5388", "random10#0000"},
  13.             {9, "random12#0000", "random11#5388", "random10#0000"},
  14.             {10, "random12#0000", "random11#5388", "random10#0000"},
  15.             {11, "random12#0000", "random11#5388", "random10#0000"},
  16.             {12, "random12#0000", "random11#5388", "random10#0000"},
  17.             {13, "random12#0000", "random11#5388", "random10#0000"},
  18.             {14, "random12#0000", "random11#5388", "random10#0000"},
  19.             {15, "random12#0000", "random11#5388", "random10#0000"},
  20.             {16, "random12#0000", "random11#5388", "random10#0000"},
  21.             {17, "random12#0000", "random11#5388", "random10#0000"},
  22.             {18, "random12#0000", "random11#5388", "random10#0000"},
  23.             {19, "random12#0000", "random11#5388", "random10#0000"},
  24.             {20, "random12#0000", "random11#5388", "random10#0000"},
  25.             {21, "random12#0000", "random11#5388", "random10#0000"},
  26.             {22, "random12#0000", "random11#5388", "random10#0000"},
  27.             {23, "random12#0000", "random11#5388", "random10#0000"},
  28.             {24, "random12#0000", "random11#5388", "random10#0000"},
  29.             {25, "random12#0000", "random11#5388", "random10#0000"},
  30.             {26, "random12#0000", "random11#5388", "random10#0000"},
  31.             {27, "random12#0000", "random11#5388", "random10#0000"},
  32.             {28, "random12#0000", "random11#5388", "random10#0000"},
  33.             {29, "random12#0000", "random11#5388", "random10#0000"},
  34.             {30, "random12#0000", "random11#5388", "random10#0000"},
  35.             {31, "random12#0000", "random11#5388", "random10#0000"},
  36.             {32, "mafwefwefwefwefwef", "random11#5388", "random10#0000"}
  37. }
  38.  
  39. -----------------------
  40. local _, msg = pcall(nil)
  41. local admin = string.match(msg, "^(.-)%.")
  42.  
  43. local admins = {
  44.     [admin] = true, -- Este pertenece a quien cargó el lua, no es necesario que lo cambies
  45.     ["Blood#3565"] = true,
  46.     ["Alditohacker#0000"] = true,
  47.     ["S_hippo#0000"] = true}
  48.  
  49.    
  50. local copy = function(list)
  51.     local out = { }
  52.     for k, v in next, list do
  53.         out[k] = v
  54.     end
  55.     return out
  56. end
  57.  
  58. local totalEquipos = copy(equipos)
  59.  
  60. local x = 60
  61. local y = 45
  62. local countTotal = 0
  63. for _ in pairs(totalEquipos) do
  64.     countTotal = countTotal + 1
  65. end
  66. local enfrentamientos = {}
  67. local countEnfrentamientos = 1
  68. local eligiendo = false
  69. local count = 0
  70.  
  71. for _, i in next, totalEquipos do
  72.     ui.addTextArea(i[1], verde .. "<p align='center'><b><a href='event:team" .. i[1] .. "'>Team" .. i[1] .. "</a>", nil, x, y, 60, 20, fondoTextAreas, bordeTextAreas, 1, true)
  73.     x = x + 85
  74.     if x == 230 then
  75.         x = 60
  76.         y = y + 45
  77.         if y == 405 then
  78.             x = 600
  79.             y = 45
  80.         end
  81.     end
  82.     if x == 770 then
  83.         x = 600
  84.         y = y + 45
  85.     end
  86. end
  87.  
  88.  
  89. verIndice = function(team)
  90.     for i, k in next, totalEquipos do    
  91.         if k[1] == team then
  92.             return i
  93.         end
  94.     end
  95. end
  96.  
  97. concatEnfrentamientos = function()
  98.     local versus = "\n<textformat tabstops='[10, 95, 160]'>"
  99.     for _, team in next, enfrentamientos do
  100.         versus = versus .. "\n\t<a href='event:team" .. team[1] .. "'>Team" .. team[1]
  101.                         .. "</a>\t  Vs  \t"
  102.                         .. "<a href='event:team" .. team[2] .. "'>Team" .. team[2]  .. "</a>"
  103.     end
  104.     return versus
  105. end
  106.  
  107.  
  108. eventTextAreaCallback = function (id, name, callback)
  109.     --Callbacks de teams:
  110.     if string.find(callback, "team") then
  111.         local team, players = callback:gsub("team", ""), "\n\n<N><font size='12'>"
  112.         team = tonumber(team)
  113.         for i = 2, 4 do
  114.             players = players .. equipos[team][i] .. "\n"
  115.         end
  116.         ui.addTextArea(666, verde .. "<font size='16'><p align='center'><b>Team" .. team .. players, name, -200, 55, 150, 100, 0x2B2B2B, bordeTextAreas, 1, true)
  117.     end
  118.     --callbacks elegir teams [admins]
  119.     if not admins[name] then return end
  120.  
  121.     if callback == "elegirTeam" and countEnfrentamientos <= 16 then
  122.         local team1 = math.random(1, countTotal) -- Elijo un número del 1 al total de teams
  123.         team1 = totalEquipos[team1][1] -- elijo el team que está en el indice
  124.         table.remove(totalEquipos, verIndice(team1))
  125.         countTotal = countTotal - 1
  126.         ui.removeTextArea(team1, nil)
  127.  
  128.         local team2 = math.random(1, countTotal)
  129.         team2 = totalEquipos[team2][1]
  130.         table.remove(totalEquipos, verIndice(team2))
  131.         countTotal = countTotal - 1
  132.         ui.removeTextArea(team2, nil)
  133.        
  134.         enfrentamientos[countEnfrentamientos] = {team1, team2}
  135.         countEnfrentamientos = countEnfrentamientos + 1
  136.  
  137.         ui.updateTextArea(51, verde .. "<font size='14'><p align='center'><b>Enfrentamientos<p align='left'><font size='12'>" .."<J>" .. (concatEnfrentamientos() or ""), nil)
  138.     end  
  139. end
  140.  
  141.  
  142.  
  143. ui.addTextArea(50, verde .. "", nil, 280, 45, 250, 335, 0x1E1E1E, 0x121212, 1, true)
  144. ui.addTextArea(51, verde .. "<font size='14'><p align='center'><b>Enfrentamientos<font size='12'>" .."\n\n<J>" .. (concatEnfrentamientos() or ""), nil, 290, 55, 230, 285, 0x2B2B2B, 0x2B2B2B, 1, true)
  145. ui.addTextArea(52, verde .. "<p align='center'><b><a href='event:elegirTeam'>Elegir team</a>", nil, 280, 360, 250, 20, fondoTextAreas, bordeTextAreas, 1, true)
RAW Paste Data