Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Eliminatoria minigame
mapList = {7684582,7682357,7684585,7682364,7684581,7682369,7682377,7682373,7682375,7637516,7658356,7637530,7637533,7637536,7658353,7637550,7637555,7637577,7637579,7658360,7637600,7637608,7637850,7637851,7637854,7637857,7637874,7637877,7658380,7658381,7658386,7658389,7658390,7658392,7658394,7658395,7658713,7658715,7658718,7658723,7658734,7658735,7658738,7658739,7658742,7658743,7658745,7659965,7660275,7660277,7660283,7660290,7660300,7660302,7660306,7660315,7661939,7661940,7661943,7661944,7661948,7661949,7661952,7661953,7661954,7661957,7661973,7661978,7661979,7661980,7661985,7661989,7661990,7662872,7662873,7662874,7662876,7662877,7662880,7662881,7662882,7662883,7662885,7662887,7662888,7662890,7662891,7662892,7662893,7662894,7662895,7662896,7662897,3574927,7662901,7662902,7662907,7662908,7662909,7662911,7662912,7662913,7662915,7662917,7662918,7662919,7665045,7665047,7665049,7665054,7665056,7665057,7665058,7665063,7665067,7665074,7665087,7665090,7665092,7665095,7665097,7684584,7677528,7677530,7677833,7677836,7680904,7680913,7681785,7681787,7681788,7681790,7681793,7686243,7686249,7686254,7686257,7686260,7686264,7686266,7686267,7686270,7686271,7686273,7686527,7686528,7686531,7686534,7686536,7686539,7686543,7686545,7686547,7686547,7686548,7686549,7686550,7686552,7686554,7686559,7686571,7686727,7686728,7686733,7686736,7686740,7686741,7686744,7686755,7686758,7686762,7689632,7691492,7691897,7689626,7689622,7689616,7689613,7689611,7689608,7689604,7689602,7689600,7689597,7689595,7689591,7688803,7688801,7688800,7688799,7688796,7688795,7688794,7688791,7688789,7688785,7688783,7688781,7688780,7688778,7688774,7688771,7688770,7688768,7688766,7688764,7688761,7688760,7688567,7688565,7688564,7688556,7688543,7678759,7691897,7692918,7693277,7693278,7693279,7693280,7693904,7694912,7694917,7694919,7694921,7642402,7642398,7695425} local mainAdmin = "Villaaam#0000" -- MAIN ADMIN local perm = { ['Villaaam#0000'] = true, ['Whyson2#4532'] = true} -- Admins local players = {} local data = {} local canFinish = false local kicking = false local startGame = false local finishGame = false local queueMaps = {} local maxPlayers = 200 local playersInGame = 0 local mapName = 'Villaaam#0000' local mapCode = '17' local roundWinner = '' local mapWinner = '' ---Players Name Color In the Starting Map-- local nameColor = "#FD06D9" --Change the color code in here! function mapChange() if #queueMaps > 0 then tfm.exec.newGame(table.remove(queueMaps, 1)) else tfm.exec.newGame(mapList[math.random(0, #mapList)]) end end -- [[ Disable ]] -- system.disableChatCommandDisplay(nil) for _, v in next, {'AutoTimeLeft', 'AutoShaman', 'AutoNewGame', 'AutoScore', 'AfkDeath', 'PhysicalConsumables', 'disableMortCommand', 'disableDebugCommand', 'disableMinimalistMode'} do tfm.exec['disable' .. v]() end -- [[ Functions Lib ]] -- local split = function(str, s) local res = {} for part in string.gmatch(str, "[^" .. s .. "]+") do table.insert(res, part) end return res end local showPlayers = function(name, display) if (display == nil) then display = true end local addTextArea = function(...) if (display) then ui.addTextArea(...) end end if (playersInGame > 0) then local a = 1 local list = { "<p align='center'>" } local n, i, id = 0, 1, 1 local text = '' for k in next, players do if (k ~= name) then local nick, tag = k:match('(.-)#(%d+)');tag = "<g><font size='9'>#" .. tag .. "</font></g>" n = (n + 1) if (n >= 10) then i = (i + 1);list[i] = "<p align='center'>" text = (kicking and "<a href='event:" .. k .. "'>" or '') .. nick .. tag .. '\n' n = 1 id = (id + 1) else text = (kicking and "<a href='event:" .. k .. "'>" or '') .."<font color='" ..nameColor .."'>" ..nick ..tag ..'\n' end list[i] = list[i] .. text end end local x = 6 for i = 1, #list do addTextArea(i, list[i], name, x, 80, 180, 310, 0x060606, 0x060606, .8, true) x = (x + (i == 1 and 193 or 203)) end if (kicking) then 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) end return #list end end local start = function() playersInGame = 0 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>') for k in next, perm do 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) end 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) for k in next, tfm.get.room.playerList do tfm.exec.setPlayerScore(k, 0) end showPlayers(nil) end system.bindMouse("Villaaam#0000", true) system.bindMouse("Whyson2#4532", true) function eventMouse(name, x, y) tfm.exec.movePlayer(name,x,y,false,0,0,true) end -- [[ API Functions ]] -- function eventNewPlayer(name) if not data[name] then data[name] = {color=0xFFFFFF} end tfm.exec.setNameColor(name, data[name].color) if (not startGame) then local text = "<p align='center'><j>Joined" if (not players[name]) then text = "<p align='center'><a href='event:entry'><font size='13' color='#FFB710'><font face='Candara'><n><b>Join" end ui.addTextArea(0, text, name, 644, 25, 150, 20, 0x060606, 0, .8) showPlayers(name) end tfm.exec.setPlayerScore(name, 0) end table.foreach(tfm.get.room.playerList, eventNewPlayer) function eventNewGame() canFinish = false kicking = false mapWinner = '' for name, player in next, tfm.get.room.playerList do if (perm[name] and data[name]) then tfm.exec.setNameColor(name, data[name].color) end end if (startGame) then ui.removeTextArea(0);local a = showPlayers('?', false);for b = 1, a do ui.removeTextArea(b, name) end tfm.exec.addPhysicObject(0, 380, -325, {type = 14, width = 40, height = 10}) tfm.exec.addPhysicObject(1, 380, -365, {type = 14, width = 60, height = 10}) tfm.exec.addPhysicObject(2, 355, -340, {type = 14, width = 40, height = 10, angle = -90}) tfm.exec.addPhysicObject(3, 405, -340, {type = 14, width = 40, height = 10, angle = -90}) for k in next, tfm.get.room.playerList do if (not players[k]) then tfm.exec.movePlayer(k, 380, -340) end end tfm.exec.setGameTime(63) ui.setMapName("<font color='#FD06D9'>Eliminatoria | Competidores: "..playersInGame.." / "..maxPlayers) if (roundWinner ~= '') then if (finishGame) then if (players[roundWinner] and #players[roundWinner] > 0) then local text = 'Eliminated: ' for i = 1, #players[roundWinner] do local nick, tag = '<n>' .. players[roundWinner][i]:match('(.-)#[0-9]+$'), "<ch><font size='9'>" .. players[roundWinner][i]:match('#[0-9]+$') text = text .. nick .. tag .. (i < #players[roundWinner] and '<n>,</n> ' or '<n>.</n>') end ui.addTextArea(0, text, nil, 5, 25, 200, nil, 0x060606, 0, .8) end tfm.exec.setGameTime(30) tfm.exec.setUIMapName("<n>Created by</n> <j>Villaaam#0000</j>") end end else players = {} tfm.exec.setGameTime(99999) end mapName = (tfm.get.room.xmlMapInfo.author ~= '#Module' and tfm.get.room.xmlMapInfo.author or mapName) mapCode = tfm.get.room.currentMap or mapCode end function eventLoop(elapsed, remaining) local remaining = math.floor(remaining / 1000) if (elapsed <= 1000) then tfm.exec.playEmote(roundWinner, 0) end if (remaining < 0) then if (finishGame) then finishGame = false startGame = false start() return end if (startGame) then if (canFinish and roundWinner ~= '') then finishGame = true 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>') else mapChange() end else ui.removeTextArea(0) start() end end end function eventPlayerWon(name) if (startGame) then if (mapWinner == '') then mapWinner = name local a = 0 for k in next, players do a = (a + 1) end if (a > 2) then kicking = true tfm.exec.setGameTime(10, false) showPlayers(name) else for k in next, players do if (k ~= name) then players[k] = nil break end end canFinish = true roundWinner = name tfm.exec.setGameTime(4, false) end tfm.exec.setPlayerScore(name, tfm.get.room.playerList[name].score + 1) end end end function eventPlayerDied(name) local t = {} for k, v in next, tfm.get.room.playerList do if (not v.isDead) then t[#t + 1] = k end end for i = 1, #t do if (players[t[i]]) then return end end if (startGame) then mapChange() end end function eventPlayerLeft(name) if (players[name]) then players[name] = nil if (playersInGame > 0) then playersInGame = (playersInGame - 1) end ui.setMapName("<font color='#FD06D9'>Eliminatoria | Competidores: "..playersInGame.." / "..maxPlayers) end if (not startGame) then showPlayers(nil) end if (kicking) then showPlayers(mapWinner) end end function eventChatCommand(name, cmd) cmd = split(cmd, ' ') -- [[ Adm Commands ]] -- if (perm[name]) then if (cmd[1] == 'start') then local a = playersInGame if (a > 1) then for i = -1, a do ui.removeTextArea(i) end startGame = true mapChange() end elseif cmd[1] == 'kill' and cmd[2] ~= nil then tfm.exec.killPlayer(cmd[2]) elseif cmd[1] == 'skip' then mapChange() elseif name:lower() == mainAdmin:lower() and cmd[1] == 'admin' and cmd[2] ~= nil then if perm[cmd[2]] then perm[cmd[2]] = false for name, value in next, perm do ui.addPopup(1, 0, string.format("%s is not Admin anymore.", cmd[2]), name, 250, 170, 300, true) end else perm[cmd[2]] = true for name, value in next, perm do ui.addPopup(1, 0, string.format("%s is now Admin.", cmd[2]), name, 250, 170, 300, true) end end elseif cmd[1] == 'np' and cmd[2] ~= nil then table.insert(queueMaps, cmd[2]) elseif cmd[1] == 'namecolor' then ui.showColorPicker(1661, name, data[name].color or 0xFFFFFF, "Choose name color") end end end function eventColorPicked(id, name, color) if id == 1661 then if perm[name] and data[name] then data[name].color = color tfm.exec.setNameColor(name, color) end end end function eventTextAreaCallback(id, name, cb) if (cb == 'entry') then if (not players[name]) then players[name] = {color = 0xffffff} playersInGame = (playersInGame + 1) ui.setMapName("<font color='#FD06D9'>Eliminatoria | Competidores: "..playersInGame.." / "..maxPlayers) ui.updateTextArea(0, '<n>Joined', name) showPlayers(nil) end elseif (cb == 'start') then eventChatCommand(name, cb) elseif (players[cb] and kicking) then if (playersInGame > 0) then playersInGame = (playersInGame - 1) end kicking = false players[cb] = nil local a = 1 for k in next, players do a = (a + 1) end for i = 1, a do ui.removeTextArea(i) end players[name][#players[name] + 1] = cb 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) ui.setMapName("<font color='#FD06D9'>Eliminatoria | Competidores: "..playersInGame.." / "..maxPlayers) tfm.exec.setGameTime(15, false) end end start()
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
test123
Show current system clock
python like round function in lua
Random Item Generator (1 year)
855
Replace all substring in string
Fixed
фыв
Percentage Calculator (Subscribe to Madflag19)
PAID HACK PuBG
Please log in to post a comment.