Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- CMDS:
- 1. !team1 "playername" "playername" \\Assign players to team1 , ex: !team1 Ctmce Ziggy_z
- 2. !team2 "playername "playername" \\Assign players to team2 , ex: !team2 Ctmce Ziggy_z
- 3. !add team1 "playername" "playername" \\Adds the player team1.
- 4. !add team2 "playername" "playername" \\Adds the player team2.
- 5. !remove team1 "playername" "playername" \\Removes the player/'s from team1!
- 6. !remove team2 "playername" "playername" \\Removes the player/'s from team2!
- 7. !exit \\Closing the Admin Panel//
- 8. !start \\Shows the Admin Panel back//
- 9. !sp team1 23 \\Sets the points for team1 to 23 or whatever you choose!
- 10. !sp team2 15 \\Sets the points for team1 to 15 or whatever you choose!
- 11. !aj on / off \\Turns AutoJoin On and Off.
- 12. !pause //pauses the game , and shows the gui back ^^
- ---------------------------------
- Total Commands Count: [8].
- Total BootcampMaps Count: [222].
- Total RacingMaps Count: [1424].
- ---------------------------------
- TODO:
- 1. Make 4 teams!
- --]]
- --Admin/Game Setup--
- --local Admin = "Misterthepro#0000" --Write your name here to be able to use the Admin Panel--
- local admin = {
- ["Blood#3565"] = true,
- ["Rastaandy#0000"] = true,
- ["Kevinho#0873"] = true,
- ["His#0439"] = true
- }
- local ScoreToWin = 15 --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 = "Red"
- local team2Color = "Blue"
- local mod = "Bootcamp"
- --DO NOT CHANGE THE SCRIPT!--
- local teams = {Team1 = {}, Team2 = {}}
- --Team score--
- local teamScore = {Team1 = 0, Team2 = 0}
- --------------
- ---Maps---
- local racingMaps = {'#17'}
- local vanillaMaps = {1, 2, 6, 7, 8, 10, 11, 12, 13, 14, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 49, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 73, 74, 75, 76, 78, 79, 80, 82, 83, 84, 85, 86, 88, 73, 74, 75, 76, 78, 89, 92, 95, 96, 100, 114, 117, 118, 119, 202, 203, 205, 206, 120, 121, 122, 123, 124, 125, 126, 127, 138, 142, 145, 147, 148, 149, 150, 151, 200, 19, 22, 23, 24, 27, 28, 29, 30, 201, 202, 203, 205, 206, 207, 208, 210, 7008845, 7121189}
- local rMaps = {}
- local mRound = 5
- ----------
- local teamColors = {Red = 'CB546B', Blue = '2F7FCC'}
- 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")
- 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("Se murieron todos jajaencerio")
- 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(7692692,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(7692692,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 admin[player] then
- --if id == 8 then
- --if callback == "bc" then
- -- mod = "Bootcamp"
- --ShowStartBoard()
- -- end
- if id == 10 then
- if callback == "start" then
- for i=0, 22,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 callback == "versus1" then
- teams.Team1 = {}
- teams.Team2 = {}
- table.insert(teams.Team1,"Cele#1786")
- table.insert(teams.Team1,"Loot#1008")
- table.insert(teams.Team2,"Furyanx#5029")
- table.insert(teams.Team2,"Jersey#6013")
- ShowStartBoard()
- elseif callback == "versus2" then
- teams.Team1 = {}
- teams.Team2 = {}
- table.insert(teams.Team1,"Stylarz#4832")
- table.insert(teams.Team1,"Skipper#3142")
- table.insert(teams.Team2,"Paulo_londra#3936")
- table.insert(teams.Team2,"Miguelk#9283")
- ShowStartBoard()
- elseif callback == "versus3" then
- teams.Team1 = {}
- teams.Team2 = {}
- table.insert(teams.Team1,"Nel#0938")
- table.insert(teams.Team1,"Polyrina#9133")
- table.insert(teams.Team2,"Tattookings#0000")
- table.insert(teams.Team2,"Sacxre#0000")
- ShowStartBoard()
- elseif callback == "versus4" then
- teams.Team1 = {}
- teams.Team2 = {}
- table.insert(teams.Team1,"Joy#6234")
- table.insert(teams.Team1,"Briizero#0000")
- table.insert(teams.Team2,"Maldiney#0000")
- table.insert(teams.Team2,"Salvo#2724")
- ShowStartBoard()
- elseif callback == "versus5" then
- teams.Team1 = {}
- teams.Team2 = {}
- table.insert(teams.Team1,"Ups7o7#4511")
- table.insert(teams.Team1,"Ambar#8601")
- table.insert(teams.Team2,"Wiiiiiiiiiiiiin#8992")
- table.insert(teams.Team2,"Tellkbe#2842")
- ShowStartBoard()
- elseif callback == "versus6" then
- teams.Team1 = {}
- teams.Team2 = {}
- table.insert(teams.Team1,"Khan#3090")
- table.insert(teams.Team1,"Jothissj#6001")
- table.insert(teams.Team2,"Blood#3565")
- table.insert(teams.Team2,"Kevinho#0873")
- ShowStartBoard()
- elseif callback == "versus7" then
- teams.Team1 = {}
- teams.Team2 = {}
- table.insert(teams.Team1,"Talon#3524")
- table.insert(teams.Team1,"Faker#4927")
- table.insert(teams.Team2,"Fenix#6083")
- table.insert(teams.Team2,"Godoyzikamem#0000")
- ShowStartBoard()
- elseif callback == "versus8" then
- teams.Team1 = {}
- teams.Team2 = {}
- table.insert(teams.Team1,"Rafarzc#4839")
- table.insert(teams.Team1,"Rubensexi#0000")
- table.insert(teams.Team2,"Yembal#0000")
- table.insert(teams.Team2,"Grupomelodia#0000")
- ShowStartBoard()
- end
- end
- end
- function eventChatCommand(name, command)
- if admin[name] 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
- if teamScore.Team1 <= 6 and teamScore.Team2 <= 6 then
- map = racingMaps[math.random(#racingMaps)]
- else
- map = vanillaMaps[math.random(#vanillaMaps)]
- end
- tfm.exec.newGame(map)
- 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()
- gameTime.Minutes = 1
- gameTime.Seconds = 50
- 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'><font size='13'> Administradores: <font color='#00ff40'><b>Rastaandy#0000", nil, 247, 367, 305, 25, 0x324650, 0x000000, 0.8, true)
- ui.addTextArea(1, "", nil, 208, 33, 381, 362, 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'>Rc - Vanilla", nil, 354, 60, 89, 19, 0x324650, 0x000000, 1, true)
- ui.addTextArea(5, "<font size='12'><p align='center'><b><font color='#00C17C'> \\ Magic Star / </font></b>", 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, "Racing 2/4 Teams!", nil, 510, 33, 109, 20, 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'>Racing</a>", nil, 365, 157, 69, 20, 0x1a0d6e, 0x000000, 1, true)
- ui.addTextArea(10, "<p align='center'><font size='13'><b><a href='event:start'><A:ACTIVE>Start</a></font>", nil, 359, 180, 82, 23, 0x324650, 0x000000, 1, true)
- ui.addTextArea(11, "<p align='center'>Score: <a href='event:dec'>-</a><font color='#00C17C'> "..ScoreToWin .." </font><a href='event:inc'>+</a>", nil, 356, 210, 87, 20, 0x324650, 0x000000, 1, true)
- ui.addTextArea(12, "<p align='center'><b><T><a href='event:versus1'>Versus 1</T>", nil, 217, 335, 65, 20, 0x324650, 0x000000, 1, true)
- ui.addTextArea(13, "<p align='center'><b><V><a href='event:versus2'>Versus 2</V>", nil, 315, 335, 65, 20, 0x324650, 0x000000, 1, true)
- ui.addTextArea(14, "<p align='center'><b><VP><a href='event:versus3'>Versus 3</VP></a>", nil, 418, 335, 65, 20, 0x324650, 0x000000, 1, true)
- ui.addTextArea(15, "<p align='center'><b><CH><a href='event:versus4'>Versus 4</CH>", nil, 518, 335, 65, 20, 0x324650, 0x000000, 1, true)
- ui.addTextArea(16, "<p align='center'><b><T><a href='event:versus5'>Versus 5</T>", nil, 217, 370, 65, 20, 0x324650, 0x000000, 1, true)
- ui.addTextArea(17, "<p align='center'><b><V><a href='event:versus6'>Versus 6</V>", nil, 315, 370, 65, 20, 0x324650, 0x000000, 1, true)
- ui.addTextArea(18, "<p align='center'><b><VP><a href='event:versus7'>Versus 7</VP></a>", nil, 418, 370, 65, 20, 0x324650, 0x000000, 1, true)
- ui.addTextArea(19, "<p align='center'><b><CH><a href='event:versus8'>Versus 8</CH>", nil, 518, 370, 65, 20, 0x324650, 0x000000, 1, true)
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement