Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Admin/Game Setup--
- local Admin = "Oxsten#9424" --Write your name here to be able to use the Admin Panel--
- local ScoreToWin = 20 --Type here the amount of points need to win the game(Leave it at the same number it is right now if you want to change it in the Setup Panel)--
- local autoJoin = true
- local team1Color = "Green" --List of colors ["Pink","Blue","Green","White"]--
- local team2Color = "Blue" --List of colors ["Pink","Blue","Green","White"]--
- local mod = "Bootcamp"
- --^^^^^^^^^^^^^^^^^^^CHANGE ONLY THE THINGS ABOVE^^^^^^^^^^^^^^^^^^^--
- --------------
- --DO NOT CHANGE THE SCRIPT!--
- local teams = {Team1 = {}, Team2 = {}}
- --Team score--
- local teamScore = {Team1 = 0, Team2 = 0}
- --------------
- ---Maps---
- local racingMaps = {"7025177"}
- local bootcampMaps = {"227093","2693344","191642","171480","172520","410045","172547","376704","184648","1951944","3024606","2817711","1000006","528032","1595965","2311703","187035","171776","185873","514311","314743","3734997","586901","169110","842019","157203","3200001","3668866","2858882","2692883","222910","2718406","3242049","2933390","403940","3000006","4488666","183139","2176211","4627777","4644584","315800","6041917","206396","319443","2466489","2208924","834297","2024960","560583","3199998","2738370","7062569","177652","191177","3043779","361500","4333895","3999979","184868","1580356","506613","5522262","397467","506940","2574960","157960","184817","729863","331988","166805","284134","1802528","6533602","220352","186855","2967631","455271","497965","478236","1523082","3380788","5092739","392861","178297","1601992","261814","373105","263819","208940","564198","3659983","3338283","165186","4311255","257324","419369","596239","1384078","591528","182370","1531604","3560999","503679","172976","2130169","505619","168754","163172","166361","156720","155628","149422","155606","150664","149451","192519","912356","299942","815336","292808","3907267","179488","511136","296020","1678634","3969628","655207","281948","166271","173816","394132","159932","171148","1636814","4398794","185289","2427910","277631","2432090","375455","4595576","1225867","3848147","3860578","4660408","1526894","4313858","2925531","1705006","2996951","5598943","4594304","692650","3182006","1962695","6642996","6675248","6600067","5000126","3888888","2252731","4445580","3333223","2989803","2636519","2423300","1807217","1788490","1647131","1615949","1435902","1427980","1390405","1255359","7001001","7000066","4000010","2605186","658960","6621953","2998268","621850","1852910","3734984","3838020","6609034","4337732","6304911","3866660","3734998","3734996","3734989","3484437","3428069","2933011","4889180","2901717","2854813","2682583","2636207","2239788","2484316","1952415","1296299","720672","554154","305680","281985","249760","167333","3734999","692740","543010","541693","439092","814311","6079100","298424","286254","2999994","2617140","3767893","557074","510996","201000","1403454","2777168","3920916","3964892","575497","7013355"}
- local rMaps = {}
- local mRound = 5
- ----------
- local teamColors = {Pink = 'd67ad6', Blue = '2b95ff', Green = '5eff6e', White = 'ffffff'}
- local first = false
- ---Game Time Settings----
- local gameTime = {Minutes = 1,Seconds = 2}
- local Ticker = 0
- -------------------------
- local gameStarted = false
- currentMap = 0
- team1C = team1Color
- team2C = team2Color
- function main()
- tfm.exec.disableAllShamanSkills(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableDebugCommand(true)
- tfm.exec.disablePhysicalConsumables(true)
- checkColor()
- ShowStartBoard()
- end
- function eventNewGame()
- if gameStarted then
- currentMap = tostring(tfm.get.room.currentMap)
- setTimeMode()
- for n,p in pairs(tfm.get.room.playerList) do
- if not PlayerInTeam(n) then
- tfm.exec.killPlayer(n)
- end
- end
- SetPlayerNameColor()
- first = false
- if mod == "Bootcamp" then
- tfm.exec.setUIMapName(currentMap .." <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#"..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> / <n>D:" ..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes ..":" ..gameTime.Seconds .."\n")
- elseif mod =="Racing" then
- tfm.exec.setUIMapName(currentMap .." <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2 .."</font> / <n>D:"..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes ..":0" ..gameTime.Seconds .."\n")
- end
- end
- end
- function eventNewPlayer(plr)
- if gameStarted then
- if PlayerInTeam(plr) then tfm.exec.killPlayer(plr) return end
- if autoJoin then
- if #teams.Team1 == #teams.Team2 then
- table.insert(teams.Team1,plr)
- elseif #teams.Team1 > #teams.Team2 then
- table.insert(teams.Team2,plr)
- end
- end
- end
- end
- function eventPlayerDied(plr)
- if gameStarted then
- local plrCount = 0
- for n,p in pairs(tfm.get.room.playerList) do
- if not p.isDead then
- plrCount = plrCount + 1
- end
- end
- if plrCount <= 0 then
- newMap()
- print("WTF3")
- end
- end
- end
- function eventPlayerWon(plr, TT, wonTime)
- if gameStarted then
- if PlayerInTeam(plr) then
- if not first then
- if table.contain(teams.Team1,plr) then
- first = true
- teamScore.Team1 = teamScore.Team1 + 1
- tfm.exec.setPlayerScore(plr, 1,true)
- gameTime.Minutes = 0
- gameTime.Seconds = 3
- if tonumber(teamScore.Team1) >= tonumber(ScoreToWin) then
- print("Team 1 won the game! The last point made by: "..plr)
- gameStarted = false
- tfm.exec.newGame(5008162,true)
- ShowStartBoard()
- ui.addTextArea(16, "<font size='13' color='#ffffff'><i>Team</font><font color='#" ..team1Color .."'> " ..team1C .."</font> won the game!</font></font>", nil, 8, 166, 202, 60, 0x000000, 0x5eff6e, 0, true)
- ui.addTextArea(17, "<font size='13' color='#ffffff'><i>The Player:<font color='#"..team1Color .."'> "..plr .."</font> made the last point!", nil, 602, 166, 188, 61, 0xffffff, 0x5eff6e, 0, true)
- end
- else
- first = true
- --if the plr form team2 then
- teamScore.Team2 = teamScore.Team2 + 1
- tfm.exec.setPlayerScore(plr, 1,true)
- gameTime.Minutes = 0
- gameTime.Seconds = 3
- if tonumber(teamScore.Team2) >= tonumber(ScoreToWin) then
- print("Team 2 won the game! The last point made by: "..plr)
- gameStarted = false
- tfm.exec.newGame(5008162,true)
- ShowStartBoard()
- ui.addTextArea(16, "<font size='13' color='#ffffff'><i>Team</font><font color='#" ..team2Color .."'> " ..team2C .."</font> won the game!</font></font>", nil, 8, 166, 202, 60, 0x000000, 0x5eff6e, 0, true)
- ui.addTextArea(17, "<font size='13' color='#ffffff'><i>The Player:<font color='#"..team2Color .."'> "..plr .."</font> made the last point!", nil, 602, 166, 188, 61, 0xffffff, 0x5eff6e, 0, true)
- end
- end
- end
- end
- end
- end
- function eventTextAreaCallback(id, player, callback)
- if player == Admin or player == "Ctmce" then
- if id == 8 then
- if callback == "bc" then
- mod = "Bootcamp"
- ShowStartBoard()
- end
- elseif id == 9 then
- if callback == "rc" then
- mod = "Racing"
- ShowStartBoard()
- end
- elseif id == 10 then
- if callback == "start" then
- for i=0, 17,1 do
- ui.removeTextArea(i)
- end
- gameStarted = true
- teamScore.Team1 = 0
- teamScore.Team2 = 0
- resetScore()
- print("Game started! Made by - Ctmce -")
- newMap()
- end
- elseif id == 11 then
- if callback == "dec" then
- if tonumber(ScoreToWin) > 1 then
- ScoreToWin = ScoreToWin - 1
- ShowStartBoard()
- end
- elseif callback == "inc" then
- if tonumber(ScoreToWin) < 99 then
- ScoreToWin = ScoreToWin + 1
- ShowStartBoard()
- end
- end
- elseif id == 12 then
- if callback == "OnAndOff" then
- autoJoin = not autoJoin
- ShowStartBoard()
- end
- elseif id == 15 then
- if callback == "Fill" then
- FillTeams()
- ShowStartBoard()
- end
- end
- end
- end
- function eventChatCommand(name, command)
- if name == Admin or name == "Ctmce" then
- local arg={}
- for argument in command:gmatch("[^%s]+") do
- table.insert(arg,argument)
- end
- if arg[1]:lower() == "team1" and arg[2] ~= nil then
- teams.Team1 = {}
- for i,v in pairs(arg) do
- if i > 1 then
- if PlayerCheck(v) then
- if TeamFix(v) == "team2"then
- table.clear(teams.Team2,v)
- table.insert(teams.Team1,v)
- if not gameStarted then
- ShowStartBoard()
- end
- else
- table.insert(teams.Team1,v)
- if not gameStarted then
- ShowStartBoard()
- end
- end
- else
- print("Sory couldn't found: " .. tostring(v))
- end
- end
- end
- elseif arg[1]:lower() == "team2" and arg[2] ~= nil then
- teams.Team2 = {}
- for i,v in pairs(arg) do
- if i > 1 then
- if PlayerCheck(v) then
- if TeamFix(v) == "team1"then
- table.clear(teams.Team1,v)
- table.insert(teams.Team2,v)
- if not gameStarted then
- ShowStartBoard()
- end
- else
- table.insert(teams.Team2,v)
- if not gameStarted then
- ShowStartBoard()
- end
- end
- else
- print("Sory couldn't found: " .. tostring(v))
- end
- end
- end
- elseif arg[1]:lower() == "add" and arg[2]:lower() == "team1" and arg[3] ~= nil then
- for i,v in pairs(arg) do
- if i > 1 then
- if PlayerCheck(v) then
- if TeamFix(v) == "team2"then
- table.clear(teams.Team2,v)
- table.insert(teams.Team1,v)
- if not gameStarted then
- ShowStartBoard()
- end
- else
- table.insert(teams.Team1,v)
- if not gameStarted then
- ShowStartBoard()
- end
- end
- end
- end
- end
- elseif arg[1]:lower() == "add" and arg[2]:lower() == "team2" and arg[3] ~= nil then
- for i,v in pairs(arg) do
- if i > 1 then
- if PlayerCheck(v) then
- if TeamFix(v) == "team1"then
- table.clear(teams.Team1,v)
- table.insert(teams.Team2,v)
- if not gameStarted then
- ShowStartBoard()
- end
- else
- table.insert(teams.Team2,v)
- if not gameStarted then
- ShowStartBoard()
- end
- end
- end
- end
- end
- elseif arg[1] == "remove" and arg[2] == "team1" and arg[3] ~= nil then
- if TeamFix(arg[3]) == "team1" then
- if not gameStarted then
- table.clear(teams.Team1,arg[3])
- ShowStartBoard()
- else
- table.clear(teams.Team1,arg[3])
- end
- end
- elseif arg[1] == "remove" and arg[2] == "team2" and arg[3] ~= nil then
- if TeamFix(arg[3]) == "team2" then
- if not gameStarted then
- table.clear(teams.Team2,arg[3])
- ShowStartBoard()
- else
- table.clear(teams.Team2,arg[3])
- end
- end
- elseif arg[1]:lower() == "aj" and arg[2]:lower() == "on" and arg[3] == nil then
- autoJoin = true
- elseif arg[1]:lower() == "aj" and arg[2]:lower() == "off" and arg[3] == nil then
- autoJoin = false
- elseif arg[1]:lower() == "start" then
- if not gameStarted then
- ShowStartBoard()
- end
- elseif arg[1]:lower() == "exit" and arg[2] == nil then
- if not gameStarted then
- for i=0,17,1 do
- ui.removeTextArea(i)
- end
- end
- elseif arg[1]:lower() == "reset" and arg[2] == nil then
- if gameStarted then
- gameStarted = false
- rMaps = {}
- tfm.exec.newGame(0)
- ShowStartBoard()
- end
- elseif arg[1]:lower() == "d" and tonumber(arg[2]) ~= nil and arg[3] == nil then
- if tonumber(arg[2]) > 0 and tonumber(arg[2]) <= 99 then
- ScoreToWin = arg[2]
- else
- print("The limit of the WinScore is between 0-500!")
- end
- elseif arg[1]:lower() == "skip" and arg[2] == nil then
- newMap()
- elseif arg[1]:lower() == "sp" then
- if arg[2]:lower() == "team1" then
- if tonumber(arg[3]) ~= nil then
- if tonumber(arg[3]) < tonumber(ScoreToWin) and tonumber(arg[3]) > 0 then
- teamScore.Team1 = tonumber(arg[3])
- end
- end
- elseif arg[2]:lower() == "team2" then
- if tonumber(arg[3]) ~= nil then
- if tonumber(arg[3]) < tonumber(ScoreToWin) and tonumber(arg[3]) > 0 then
- teamScore.Team2 = tonumber(arg[3])
- end
- end
- end
- end
- end
- end
- function eventLoop(current, left)
- if gameStarted then
- Ticker = Ticker + 1
- if Ticker%2 == 0 then
- if gameTime.Minutes <= 0 and gameTime.Seconds <= 0 then
- newMap()
- elseif gameTime.Seconds < 1 then
- gameTime.Minutes = gameTime.Minutes - 1
- gameTime.Seconds = 59
- end
- if gameTime.Seconds > 9 then
- tfm.exec.setUIMapName(currentMap .." <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#"..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> / <n>D:" ..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes ..":" ..gameTime.Seconds .."\n")
- elseif gameTime.Seconds < 10 then
- -- tfm.exec.setUIMapName(currentMap .."| Time left: 0" .. gameTime.Minutes ..":0".. gameTime.Seconds .." | " ..team1C ..": ".. teamScore.Team1 .."/ "..team2C ..": "..teamScore.Team2 .."\n")
- tfm.exec.setUIMapName(currentMap .." <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2 .."</font> / <n>D:"..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes ..":0" ..gameTime.Seconds .."\n")
- end
- gameTime.Seconds = gameTime.Seconds - 1
- Ticker = 0
- end
- end
- end
- function newMap()
- --Write the maps codes first and then make it choose a random map .
- if mod == "Bootcamp" then
- local r = bootcampMaps[math.random(#bootcampMaps)]
- if tableSizeKey(rMaps,r) > 0 then
- for i,v in pairs(rMaps) do
- if rMaps[i] > 0 then
- rMaps[i] = rMaps[i] - 1
- print(rMaps[i])
- elseif rMaps[i] <= 0 then
- rMaps = table_removeKey(rMaps,i)
- end
- end
- end
- if rMaps[tostring(r)] then
- newMap()
- else
- rMaps[tostring(r)] = mRound
- tfm.exec.newGame(r)
- print(r)
- end
- elseif mod == "Racing" then
- local r = racingMaps[math.random(#racingMaps)]
- if tableSizeKey(rMaps,r) > 0 then
- for i,v in pairs(rMaps) do
- if rMaps[i] > 0 then
- rMaps[i] = rMaps[i] - 1
- print(rMaps[i])
- elseif rMaps[i] <= 0 then
- rMaps = table_removeKey(rMaps,i)
- end
- end
- end
- if rMaps[tostring(r)] then
- newMap()
- else
- rMaps[tostring(r)] = mRound
- tfm.exec.newGame(r)
- print(r)
- end
- end
- end
- function SetPlayerNameColor()
- checkColor()
- for i,v in pairs(teams.Team1) do
- tfm.exec.setNameColor(v, "0x"..team1Color)
- end
- for i,v in pairs(teams.Team2) do
- tfm.exec.setNameColor(v, "0x"..team2Color)
- end
- end
- function setTimeMode()
- if mod == "Bootcamp" then
- --Game Time for Bootcamp.--
- gameTime.Minutes = 2
- gameTime.Seconds = 2
- elseif mod == "Racing" then
- --Game Time for Racing.--
- gameTime.Minutes = 1
- gameTime.Seconds = 2
- elseif mod == nil then
- mod = "Racing"
- gameTime.Minutes = 1
- gameTime.Seconds = 2
- end
- end
- function FillTeams()
- local t = 1
- teams.Team1 = {}
- teams.Team2 = {}
- for n,p in pairs(tfm.get.room.playerList) do
- if t == 1 then
- table.insert(teams.Team1,n)
- t = 2
- elseif t == 2 then
- table.insert(teams.Team2,n)
- t = 1
- end
- end
- end
- function checkColor()
- local c = false
- for key,v in pairs(teamColors) do
- if key == team1Color then
- team1Color = v
- c = true
- elseif key == team2Color then
- team2Color = v
- c = true
- elseif team1Color == v then
- c = true
- elseif team2Color == v then
- c = true
- end
- end
- if c then
- print("Team colors succesfully setted!")
- else
- team1Color = teamColors.Green
- team2Color = teamColors.Blue
- print("Sory couldn't found the color you choosed, Defult color will be apllied.")
- end
- end
- function table.clear(t,obj)
- for i,v in ipairs(t) do
- if v==obj then
- table.remove(t,i)
- end
- end
- end
- function table.contain(t,obj)
- for i,v in pairs(t) do
- if v==obj then
- return true
- end
- end
- return false
- end
- function table_removeKey(t,i)
- local tClone = {}
- for k,v in pairs(t) do
- if k ~= i then
- tClone[k] = v
- end
- end
- return tClone
- end
- function tableSizeKey(t,i)
- local counter = 0
- for k,v in pairs(t) do
- if k ~= i then
- counter = counter + 1
- end
- end
- return counter
- end
- function resetScore()
- for n,p in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore(n, 0,false)
- end
- end
- function TeamFix(plr)
- local char = plr
- for i,v in pairs(teams.Team1) do
- if v == char then
- return "team1"
- end
- end
- for i,n in pairs(teams.Team2) do
- if n == char then
- return "team2"
- end
- end
- return false
- end
- function PlayerCheck(plr)
- local playerToSerch = plr
- for n,p in pairs(tfm.get.room.playerList) do
- if n == plr then
- return true
- end
- end
- return false
- end
- function PlayerInTeam(plr)
- local player = plr
- for i,v in pairs(teams.Team1) do
- if v == player then
- return true
- end
- end
- for i,n in pairs(teams.Team2) do
- if n == player then
- return true
- end
- end
- return false
- end
- function ShowStartBoard()
- ui.addTextArea(0, "<p align='center'>Admin: <font color='#00ff40'><b>" ..(Admin or "Floolxd"), nil, 263, 365, 265, 20, 0x324650, 0x000000, 0.8, true)
- ui.addTextArea(1, "", nil, 209, 33, 381, 326, 0x324650, 0x000000, 1, true)
- ui.addTextArea(2, "<p align='center'><font size='12' color='#" ..team1Color .."'>" .. (table.concat(teams.Team1,"\n") or ""), nil, 208, 66, 151, 254, 0x324650, 0x000000, 1, true)
- ui.addTextArea(3, "<p align='center'><font size='12' color='#" ..team2Color .."'> " .. (table.concat(teams.Team2,"\n") or ""), nil, 438, 66, 151, 254, 0x324650, 0x000000, 1, true)
- ui.addTextArea(4, "<p align='center'>Mod:" ..(mod or "Racing"), nil, 354, 60, 89, 19, 0x324650, 0x000000, 1, true)
- ui.addTextArea(5, "<font size='12'><p align='center'><b>\\ Flool Bootcamp Cup /", nil, 209, 33, 381, 21, 0x324650, 0x000000, 1, true)
- ui.addTextArea(6, "<p align='center'>Made by - <font color='#ff0000'>Ctmce</font> -", nil, 207, 33, 109, 20, 0x324650, 0x000000, 0, true)
- ui.addTextArea(7, "<p align='center'><font size='11'><font color='#ffffff'>Tribe:\n#</font><b><font color='#e8fc37'>Bootcamp Hunters</font>", nil, 470, 28, 125, 34, 0x324650, 0x000000, 0, true)
- ui.addTextArea(8, "<p align='center'><b><a href='event:bc'>Bootcamp</a>", nil, 365, 208, 69, 19, 0x540c0c, 0x000000, 1, true)
- ui.addTextArea(9, "<p align='center'><b><a href='event:rc'>--</a>", nil, 365, 157, 69, 20, 0x1a0d6e, 0x000000, 1, true)
- ui.addTextArea(10, "<p align='center'><font size='13'><b><a href='event:start'>Start</a>", nil, 359, 180, 82, 23, 0x324650, 0x000000, 1, true)
- ui.addTextArea(11, "<p align='center'>Score: <a href='event:dec'>-</a> "..ScoreToWin .." <a href='event:inc'>+</a>", nil, 435, 335, 87, 20, 0x324650, 0x000000, 1, true)
- ui.addTextArea(12, "<p align='center'>Auto Join: <a href='event:OnAndOff'>"..(autoJoin and "on" or not autoJoin and "off") .."</a>", nil, 277, 335, 87, 20, 0x324650, 0x000000, 1, true)
- ui.addTextArea(13, "<p align='center'>Individu", nil, 212, 335, 54, 20, 0x324650, 0x000000, 1, true)
- ui.addTextArea(14, "<p align='center'>Individu", nil, 533, 335, 54, 20, 0x324650, 0x000000, 1, true)
- ui.addTextArea(15, "<p align='center'><a href='event:Fill'>Add Random</a>", nil, 376, 335, 47, 20, 0x324650, 0x000000, 1, true)
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement