Rawoas13

elim

Jun 14th, 2020 (edited)
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.80 KB | None | 0 0
  1. mapList = {"6771291","332894","240780","236164","1781408","167618","390595","333425","309234","334193","249633","333051","559413","265093","212420","233520","7027330","278790","202115","272585","241802","173952","162561","254391","263899","247820","137024","260343","179642","233426","336994","162338","273832","279772","2163","266464","211663","196520","145762","233043","266860","243700","297693","289736","178046","202905","271722","202957","173344","271369","262480","440574","174718","276650","5854033","267153","274916","606666","2978151","3710926","281784","169065","157687","329656","196964","333301","333063","319062","272813","309857","258986","242032","268344","267688","237035","226903","269239","159024","255378","212279","235995","274675","262002","246169","260671","332540","275008","177229","263654","331615","262173","305792","168587","261555","1404528","240393","196780","267072","212231","278258","274194","1914792","3504036","7651733","379535","308340","312826","6606660","1794287","156908","122097","251074","292742","334411","273993","404865","327177","245204","265122","200918","278269","289876","333343","3679666","402936","412657","1612436","1613927","127419","142101","146615","159204","223983","169579","313349","238187","191575","260465","273776","331529","290052","332947","309222","270663","322014","327974","335565","313773","336003","333248","270813","294923","280417","156537","234187","143610","308200","264791","253148","265381","260525","287754","287595","230773","273994","232601","239469","19909","301901","193813","239120","202719","1481024","159038","863659","268021","72395","265329","270066","1516090","185492","308203","333060","273000","333659","333888","310741","308945","180347","367502","678181","272600","218848","311166","262873","308575","334007","143599","239012","272143","265517","215475","391021","230640","170157","180246","672674","266094","323035","220943","328605","311177","238232","1591464","278500","158731","199820","264850","194676","261136","314596","284979","1220496","6972430","5525195","5643435","1395321","6112594","1431107","4813927","334113","155355","276755","220943","161327","317373","309924","325562","317715","317752","322947","317546","329695","333300","333666","2163","15339","112887","120025","140850","157590","162374","165443","190909","180238","180264","196160","117341","117894","119814","120876","124717","132806","141355","152034","155460","162009","164334","166292","170383","170985","171414","171920","174556","174877","178800","179777","181527","181883","182387","182822","185068","185382","185621","202537","202770","211573","212407","217118","217979","219618","220915","222680","230664","231240","233592","236541","238100","238215","238638","239843","240002","241870","248162","250169","253830","255401","255609","256128","257811","258796","260118","260357","260381","260571","260805","261096","261543","262229","262486","262624","262657","262875","264019","264065","264145","264686","265279","266110","266127","266280","266493","266748","267184","268494","268914","270804","271634","272511","272580","272739","273110","273787","273818","274002","274006","274055","275066","275067","275287","275366","276105","277366","278423","278542","278585","279479","279996","284256","284962","285098","285479","289249","289811","291305","296903","305175","308185","308196","308863","309058","309245","309688","310136","310148","310685","310687","310913","311068","313191","315664","317745","317748","317987","321640","322321","323037","324430","329458","330393","331512","331572","332146","332483","332640","332827","332880","332881","333049","333071","333170","333192","308681","6212895","333354","2019746","401443","159076","294500","1149838","4103460","412657","455094","404797","1587883","3237735","369138","2012696","1629706","3054424","3203738","1861644","429339","318736","336441","273769","310247","187001","185382","185698","979740","333068","6572872","424513","334735","601203","202770","252735","334278","333653","268479","1876139","374078","400254","401869","332861","306241","353209","337720","213589","1151155","655877","334160","332014","241035","274910","287586","335457","309055","333676","336092","336144","333590","268239","269408","303246","239559","333973","334614","417168","306570","569819","333922","211902","253800","5577611","521552","7644083","337710","277260","276830","327167","323036","248760","236497","442035","334811","289376","334449","335564","368129","332864","3460996","333074","1640638","276388","334565","7178786","701899","276960","272020","240196","533491","243335","1422689","1248838","703606","308205","5578052","350258","181979","333673","529024","411536","333861","333044","220239","842585"}
  2.  
  3. local mainAdmin = "Villaaam#0000" -- MAIN ADMIN
  4. local perm = { ['Villaaam#0000'] = true, ['Whyson2#4532'] = true} -- Admins
  5. local players = {}
  6. local data = {}
  7. local canFinish = false
  8. local kicking = false
  9. local startGame = false
  10. local finishGame = false
  11.  
  12. local queueMaps = {}
  13.  
  14. local maxPlayers = 200
  15. local playersInGame = 0
  16.  
  17. local mapName = 'Villaaam#0000'
  18. local mapCode = '17'
  19. local roundWinner = ''
  20. local mapWinner = ''
  21.  
  22. local variable = value -- nem ertem
  23.  
  24. mapWinner = nil -nem ertem mert nem mukszik
  25.  
  26. ---Players Name Color In the Starting Map--
  27. local nameColor = "#FD06D9" --Change the color code in here!
  28.  
  29. function mapChange()
  30.     if #queueMaps > 0 then
  31.         tfm.exec.newGame(queueMaps[1])
  32. queueMaps[1] = nil
  33.     else
  34.         tfm.exec.newGame(mapList[math.random(0, #mapList)])
  35.     end
  36. end
  37.  
  38. -- [[ Disable ]] --
  39. system.disableChatCommandDisplay(nil)
  40.  
  41. for _, v in next, {'AutoTimeLeft', 'AutoShaman', 'AutoNewGame', 'AutoScore', 'AfkDeath', 'PhysicalConsumables'} do
  42.     tfm.exec['disable' .. v]()
  43. end
  44.  
  45. -- [[ Functions Lib ]] --
  46. local split = function(str, s)
  47.     local res = {}
  48.     for part in string.gmatch(str, "[^" .. s .. "]+") do
  49.         table.insert(res, part)
  50.     end
  51.     return res
  52. end
  53.  
  54. local showPlayers = function(name, display)
  55.     if (display == nil) then display = true end
  56.  
  57.     local addTextArea = function(...) if (display) then ui.addTextArea(...) end end
  58.    
  59.     if (playersInGame > 0) then
  60.         local a = 1
  61.      
  62.         local list = { "<p align='center'>" }
  63.         local n, i, id = 0, 1, 1
  64.    
  65.         local text = ''
  66.      
  67.         for k in next, players do
  68.             if (k ~= name) then
  69.                 local nick, tag = k:match('(.-)#(%d+)');tag = "<g><font size='9'>#" .. tag .. "</font></g>"
  70.        
  71.                 n = (n + 1)
  72.                 if (n >= 10) then
  73.                     i = (i + 1);list[i] = "<p align='center'>"
  74.  
  75.                     text = (kicking and "<a href='event:" .. k .. "'>" or '') .. nick .. tag .. '\n'
  76.  
  77.                     n = 1
  78.          
  79.                     id = (id + 1)
  80.                 else
  81.                     text = (kicking and "<a href='event:" .. k .. "'>" or '') .."<font color='" ..nameColor .."'>" ..nick ..tag ..'\n'
  82.                 end
  83.        
  84.                 list[i] = list[i] .. text
  85.             end
  86.         end
  87.  
  88.         local x = 6
  89.         for i = 1, #list do
  90.             addTextArea(i, list[i], name, x, 80, 180, 310, 0x060606, 0x060606, .8, true)
  91.        
  92.             x = (x + (i == 1 and 193 or 203))
  93.         end
  94.    
  95.         if (kicking) then
  96.             addTextArea(0, "<p align='center'><font size='16'><font face='Candara'><font color='#8B00FF'>Select a player to eliminate", name, 5, 25, 790, 25, 0x060606, 0, .8)
  97.         end
  98.    
  99.         return #list
  100.     end
  101. end
  102.  
  103.  
  104.  
  105. local start = function()
  106.     playersInGame = 0
  107.  
  108. tfm.exec.newGame('<C><P Ca=""/><Z><S><S L="795" o="66666" H="56" X="401" Y="373" T="12" P="0,0,0.3,0.2,0,0,0,0" i="-4,-398,170b5453177.jpg" /></S><D /><O /></Z></C>')
  109.  
  110.     for k in next, perm do
  111.         ui.addTextArea(-1, "<p align='center'><a href='event:start'><font size='13' color='#FFB710'><font face='Candara'><n><b><font color='#FD06D9'>Start Game", k, 5, 25, 150, 20, 0x060606, 0, .8)
  112.     end
  113.  
  114.     ui.addTextArea(0, "<p align='center'><a href='event:entry'><font size='13' color='#FFB710'><font face='Candara'><n><b><font color='#FD06D9'>Join", nil, 644, 25, 150, 20, 0x060606, 0, .8)
  115.  
  116.     for k in next, tfm.get.room.playerList do
  117.         tfm.exec.setPlayerScore(k, 0)
  118.     end
  119.  
  120.     showPlayers(nil)
  121. end
  122.  
  123. system.bindMouse("Villaaam#0000", true)
  124. system.bindMouse("Whyson2#4532", true)
  125. function eventMouse(name, x, y)
  126.     tfm.exec.movePlayer(name,x,y,false,0,0,true)
  127. end
  128.  
  129.  
  130. -- [[ API Functions ]] --
  131. function eventNewPlayer(name)
  132.     if not data[name] then
  133.         data[name] = {color=0xF734B9}
  134.     end
  135.     tfm.exec.setNameColor(name, data[name].color)
  136.     if (not startGame) then
  137.         local text = "<p align='center'><j>Joined"
  138.         if (not players[name]) then
  139.             text = "<p align='center'><a href='event:entry'><font size='13' color='#FFB710'><font face='Candara'><n><b>Join"            
  140.         end
  141.  
  142.         ui.addTextArea(0, text, name, 644, 25, 150, 20, 0x060606, 0, .8)
  143.  
  144.         showPlayers(name)
  145.     end
  146.  
  147.     tfm.exec.setPlayerScore(name, 0)
  148. end
  149. table.foreach(tfm.get.room.playerList, eventNewPlayer)
  150.  
  151. function eventNewGame()
  152.     canFinish = false
  153.     kicking = false
  154.  
  155.     mapWinner = ''
  156.  
  157.     for name, player in next, tfm.get.room.playerList do
  158.         if (perm[name] and data[name]) then
  159.             tfm.exec.setNameColor(name, data[name].color)
  160.         end
  161.     end
  162.  
  163.     if (startGame) then
  164.         ui.removeTextArea(0);local a = showPlayers('?', false);for b = 1, a do ui.removeTextArea(b, name) end
  165.  
  166.         tfm.exec.addPhysicObject(0, 380, -325, {type = 14, width = 40, height = 10})
  167.         tfm.exec.addPhysicObject(1, 380, -365, {type = 14, width = 60, height = 10})
  168.         tfm.exec.addPhysicObject(2, 355, -340, {type = 14, width = 40, height = 10, angle = -90})
  169.         tfm.exec.addPhysicObject(3, 405, -340, {type = 14, width = 40, height = 10, angle = -90})
  170.  
  171.         for k in next, tfm.get.room.playerList do
  172.             if (not players[k]) then
  173.                 tfm.exec.movePlayer(k, 380, -340)
  174.             end
  175.         end
  176.    
  177.         tfm.exec.setGameTime(63)
  178.         ui.setMapName("<font color='#98E2EB'><a:active>x1eliminatoria</a:active> <a:active>|</a:active> <V>Competidores: </V>"..playersInGame.." / "..maxPlayers)
  179.         if (roundWinner ~= '') then
  180.             if (finishGame) then
  181.                 if (players[roundWinner] and #players[roundWinner] > 0) then
  182.                     local text = 'Eliminated: '
  183.  
  184.                     for i = 1, #players[roundWinner] do
  185.                         local nick, tag = '<n>' .. players[roundWinner][i]:match('(.-)#[0-9]+$'), "<ch><font size='9'>" .. players[roundWinner][i]:match('#[0-9]+$')
  186.                         text = text .. nick .. tag .. (i < #players[roundWinner] and '<n>,</n> ' or '<n>.</n>')
  187.                     end
  188.  
  189.                     ui.addTextArea(0, text, nil, 5, 25, 200, nil, 0x060606, 0, .8)
  190.                 end
  191.                 tfm.exec.setGameTime(30)
  192.                 tfm.exec.setUIMapName("<O>Created by</O> <ROSE>Villaaam#0000</ROSE> | Winner: "..mapWinner)
  193.             end
  194.         end
  195.     else
  196.         players = {}
  197.    
  198.         tfm.exec.setGameTime(99999)
  199.     end
  200.  
  201.     mapName = (tfm.get.room.xmlMapInfo.author ~= '#Module' and tfm.get.room.xmlMapInfo.author or mapName)
  202.     mapCode = tfm.get.room.currentMap or mapCode
  203. end
  204.  
  205. function eventLoop(elapsed, remaining)
  206.     local remaining = math.floor(remaining / 1000)
  207.  
  208.     if (elapsed <= 1000) then
  209.         tfm.exec.playEmote(roundWinner, 0)
  210.     end
  211.  
  212.     if (remaining < 0) then
  213.         if (finishGame) then
  214.             finishGame = false
  215.             startGame = false
  216.  
  217.             start()
  218.  
  219.             return
  220.         end
  221.  
  222.         if (startGame) then
  223.             if (canFinish and roundWinner ~= '') then
  224.                 finishGame = true
  225.                 tfm.exec.newGame('<C><P /><Z><S><S i="-200,-250,16692e791eb.png" P=",,9999,,,,," L="400" H="10" Y="270" T="14" X="400" /><S P=",,9999,,,,," i="-66,-20,1669252905c.png" L="200" H="10" Y="300" T="14" X="400" /></S><D><DS Y="300" X="400" /></D><O /></Z></C>')
  226.             else
  227.                     mapChange()
  228.             end
  229.         else
  230.             ui.removeTextArea(0)
  231.  
  232.             start()
  233.         end
  234.     end
  235. end
  236.  
  237. function eventPlayerWon(name)
  238.     if (startGame) then
  239.         if (mapWinner == '') then
  240.             mapWinner = name
  241.  
  242.             local a = 0
  243.             for k in next, players do
  244.                 a = (a + 1)
  245.             end
  246.             if (a > 2) then
  247.                 kicking = true
  248.                 tfm.exec.setGameTime(10, false)
  249.  
  250.                 showPlayers(name)
  251.             else
  252.                 for k in next, players do
  253.                     if (k ~= name) then
  254.                         players[k] = nil
  255.  
  256.                         break
  257.                     end
  258.                 end
  259.  
  260.                 canFinish = true
  261.  
  262.                 roundWinner = name
  263.  
  264.                 tfm.exec.setGameTime(4, false)
  265.             end
  266.  
  267.             tfm.exec.setPlayerScore(name, tfm.get.room.playerList[name].score + 1)
  268.         end
  269.     end
  270. end
  271.  
  272. function eventPlayerDied(name)
  273.     local t = {}
  274.  
  275.     for k, v in next, tfm.get.room.playerList do
  276.         if (not v.isDead) then
  277.             t[#t + 1] = k
  278.         end
  279.     end
  280.  
  281.     for i = 1, #t do
  282.         if (players[t[i]]) then
  283.             return
  284.         end
  285.     end
  286.  
  287.     if (startGame) then
  288.         mapChange()
  289.     end
  290. end
  291.  
  292. function eventPlayerLeft(name)
  293.     if (players[name]) then
  294.         players[name] = nil
  295.        
  296.         if (playersInGame > 0) then playersInGame = (playersInGame - 1) end
  297.         ui.setMapName("<font color='#98E2EB'><a:active>x1eliminatoria</a:active> <a:active>|</a:active> <V>Competidores: </V>"..playersInGame.." / "..maxPlayers)
  298.     end
  299.  
  300.     if (not startGame) then
  301.         showPlayers(nil)
  302.     end
  303.  
  304.     if (kicking) then
  305.         showPlayers(mapWinner)
  306.     end
  307. end
  308.  
  309. function eventChatCommand(name, cmd)
  310.     cmd = split(cmd, ' ')
  311.  
  312.     -- [[ Adm Commands ]] --
  313.     if (perm[name]) then
  314.         if (cmd[1] == 'start') then
  315.             local a = playersInGame
  316.             if (a > 1) then
  317.                 for i = -1, a do
  318.                     ui.removeTextArea(i)
  319.                 end
  320.  
  321.                 startGame = true
  322.  
  323.                 mapChange()
  324.             end
  325.         elseif cmd[1] == 'kill' and cmd[2] ~= nil then
  326.             tfm.exec.killPlayer(cmd[2])
  327.         elseif cmd[1] == 'skip' then
  328.             mapChange()
  329.         elseif name:lower() == mainAdmin:lower() and cmd[1] == 'admin' and cmd[2] ~= nil then
  330.             if perm[cmd[2]] then
  331.                 perm[cmd[2]] = false
  332.                 for name, value in next, perm do
  333.                     ui.addPopup(1, 0, string.format("%s is not Admin anymore.", cmd[2]), name, 250, 170, 300, true)
  334.                 end
  335.             else
  336.                 perm[cmd[2]] = true
  337.                 for name, value in next, perm do
  338.                     ui.addPopup(1, 0, string.format("%s is now Admin.", cmd[2]), name, 250, 170, 300, true)
  339.                 end
  340.             end
  341.         elseif cmd[1] == 'np' and cmd[2] ~= nil then
  342.             table.insert(queueMaps, cmd[2])
  343.         elseif cmd[1] == 'namecolor' then
  344.             ui.showColorPicker(1661, name, data[name].color or 0xFFFFFF, "Choose name color")
  345.         end
  346.     end
  347. end
  348.  
  349. function eventColorPicked(id, name, color)
  350.     if id == 1661 then
  351.         if perm[name] and data[name] then
  352.             data[name].color = color
  353.             tfm.exec.setNameColor(name, color)
  354.         end
  355.     end
  356. end
  357.  
  358. function eventTextAreaCallback(id, name, cb)
  359.     if (cb == 'entry') then
  360.         if (not players[name]) then
  361.             players[name] = {color = 0xF734B9}
  362.  
  363.             playersInGame = (playersInGame + 1)
  364.            ui.setMapName("<font color='#98E2EB'><a:active>x1eliminatoria</a:active> <a:active>|</a:active> <V>Competidores: </V>"..playersInGame.." / "..maxPlayers)
  365.             ui.updateTextArea(0, '<n>Joined', name)
  366.  
  367.             showPlayers(nil)
  368.         end
  369.     elseif (cb == 'start') then
  370.         eventChatCommand(name, cb)
  371.     elseif (players[cb] and kicking) then
  372.         if (playersInGame > 0) then playersInGame = (playersInGame - 1) end
  373.  
  374.         kicking = false
  375.         players[cb] = nil
  376.  
  377.         local a = 1
  378.         for k in next, players do
  379.             a = (a + 1)
  380.         end
  381.         for i = 1, a do
  382.             ui.removeTextArea(i)
  383.         end
  384.  
  385.         players[name][#players[name] + 1] = cb
  386.        
  387.       ui.addTextArea(0, "<p align='center'><font size='26'><font face='Candara'><font color='#8B00FF'><b>" .. name .. " <font face='Candara'><font color='#060606'>eliminated: <font color='#FD06D9'><b>" .. cb, nil, 6, 186, 790, 35, 0x060606, 0, .8)
  388.    
  389.             ui.setMapName("<font color='#98E2EB'><a:active>x1eliminatoria</a:active> <a:active>|</a:active> <V>Competidores: </V>"..playersInGame.." / "..maxPlayers)
  390.         tfm.exec.setGameTime(15, false)
  391.     end
  392. end
  393.  
  394. start()
Add Comment
Please, Sign In to add comment