Advertisement
alditojeje

Untitled

Nov 19th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  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. }
  14.  
  15. -----------------------
  16. local _, msg = pcall(nil)
  17. local admin = string.match(msg, "^(.-)%.")
  18.  
  19. local admins = {
  20. [admin] = true, -- Este pertenece a quien cargó el lua, no es necesario que lo cambies
  21. ["Blood#3565"] = true,
  22. ["Alditohacker#0000"] = true,
  23. ["S_hippo#0000"] = true}
  24.  
  25. local copy = function(list)
  26. local out = { }
  27. for k, v in next, list do
  28. out[k] = v
  29. end
  30. return out
  31. end
  32.  
  33. local totalEquipos = copy(equipos)
  34.  
  35. local x = 115
  36. local y = 90
  37. local countTotal = 0
  38. for _ in pairs(totalEquipos) do
  39. countTotal = countTotal + 1
  40. end
  41. local enfrentamientos = {}
  42. local countEnfrentamientos = 1
  43. local eligiendo = false
  44. local count = 0
  45.  
  46. for _, i in next, totalEquipos do
  47. 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)
  48. y = y + 45
  49. if y == 270 then
  50. x = 645
  51. y = 90
  52. end
  53. end
  54.  
  55.  
  56. verIndice = function(team)
  57. for i, k in next, totalEquipos do
  58. if k[1] == team then
  59. return i
  60. end
  61. end
  62. end
  63.  
  64. concatEnfrentamientos = function()
  65. local versus = "\n<textformat tabstops='[10, 95, 160]'>"
  66. for _, team in next, enfrentamientos do
  67. versus = versus .. "\n\t<a href='event:team" .. team[1] .. "'>Team" .. team[1]
  68. .. "</a>\t Vs \t"
  69. .. "<a href='event:team" .. team[2] .. "'>Team" .. team[2] .. "</a>"
  70. end
  71. return versus
  72. end
  73.  
  74.  
  75. eventTextAreaCallback = function (id, name, callback)
  76. --Callbacks de teams:
  77. if string.find(callback, "team") then
  78. local team, players = callback:gsub("team", ""), "\n\n<N><font size='12'>"
  79. team = tonumber(team)
  80. for i = 2, 4 do
  81. players = players .. equipos[team][i] .. "\n"
  82. end
  83. ui.addTextArea(666, verde .. "<font size='16'><p align='center'><b>Team" .. team .. players, name, 280, 270, 250, 100, 0x2B2B2B, bordeTextAreas, 1, true)
  84. end
  85. --callbacks elegir teams [admins]
  86. if not admins[name] then return end
  87.  
  88. if callback == "elegirTeam" and countEnfrentamientos <= 4 then
  89. local team1 = math.random(1, countTotal) -- Elijo un número del 1 al total de teams
  90. team1 = totalEquipos[team1][1] -- elijo el team que está en el indice
  91. table.remove(totalEquipos, verIndice(team1))
  92. countTotal = countTotal - 1
  93. ui.removeTextArea(team1, nil)
  94.  
  95. local team2 = math.random(1, countTotal)
  96. team2 = totalEquipos[team2][1]
  97. table.remove(totalEquipos, verIndice(team2))
  98. countTotal = countTotal - 1
  99. ui.removeTextArea(team2, nil)
  100.  
  101. enfrentamientos[countEnfrentamientos] = {team1, team2}
  102. countEnfrentamientos = countEnfrentamientos + 1
  103.  
  104. ui.updateTextArea(51, verde .. "<font size='14'><p align='center'><b>Enfrentamientos<p align='left'><font size='12'>" .."<J>" .. (concatEnfrentamientos() or ""), nil)
  105. end
  106. end
  107.  
  108.  
  109.  
  110. ui.addTextArea(50, verde .. "", nil, 280, 45, 250, 190, 0x1E1E1E, 0x121212, 1, true)
  111. ui.addTextArea(51, verde .. "<font size='14'><p align='center'><b>Enfrentamientos<font size='12'>" .."\n\n<J>" .. (concatEnfrentamientos() or ""), nil, 290, 55, 235, 160, 0x2B2B2B, 0x2B2B2B, 1, true)
  112. ui.addTextArea(52, verde .. "<p align='center'><b><a href='event:elegirTeam'>Elegir team</a>", nil, 280, 230, 250, 20, fondoTextAreas, bordeTextAreas, 1, true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement