Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Admin console - To be controlled only for official events, also controls everything..
- IDBlue = 0
- IDRed = 0
- IDBlueDoor = 0
- IDRedDoor = 0
- IDSnowGenerate = 0
- IDSnowSpread = 0
- IDResetRed = 0
- IDResetBlue = 0
- IDBlueMonitor = 0
- IDRedMonitor = 0
- Password = "123"
- Hot1 = ""
- Hot2 = ""
- Hot3 = ""
- Hot4 = ""
- function CheckID(IDa)
- if IDa == IDBlue or IDa == IDRed or IDa == IDResetRed or IDa == IDResetBlue then
- return true
- else
- return false
- end
- end
- function hotBox(event)
- if not Hot2 then Hot2 = event elseif not Hot3 then Hot3 = event elseif not Hot4 then Hot4 = event end
- term.setCursorPos(1,10)
- lib.clearLine()
- Hot1 = Hot2
- Hot2 = Hot3
- Hot3 = Hot4
- Hot4 = ""
- lib.fillLine(X)
- lib.layout(Hot1, "X")
- lib.layout(Hot2, "X")
- lib.layout(Hot3, "X")
- lib.fillLine(X)
- end
- lib.Clear()
- lib.fillLine()
- lib.layout("Welcome to the admin console")
- lib.fillLine()
- lib.layout()
- lib.layout("Please type in password to carry on")
- print("")
- while true do
- event,param1,param2 = os.pullEventRaw()
- if event == "char" then
- echo = echo..param1
- fake = string.rep("*", string.len(echo))
- lib.clearLine()
- lib.layout(fake)
- lib.cursor(-1)
- elseif event == "key" then
- if param1 == 1 then -- esc
- echo = ""
- lib.clearLine()
- lib.layout()
- lib.cursor(-1)
- elseif param1 == 28 then -- enter
- if echo == password then
- lib.Clear()
- hotBox("Admin Console entered")
- break
- else
- lib.clearLine()
- lib.layout("Incorrect password")
- lib.cursor(-1)
- echo = ""
- hotBox("Idiot typed wrong pass")
- end
- elseif param1 == 14 then -- backspace
- echo = string.sub(echo, 1, -2)
- fake = string.rep("*", string.len(echo))
- lib.clearLine()
- lib.layout(fake)
- lib.cursor(-1)
- end
- elseif event == "terminate" then
- echo = ""
- lib.clearLine()
- lib.layout("[602]Error while trying to process \"terminate\"")
- lib.cursor(-1)
- hotBox("Idiot tried to terminate Admin Console")
- elseif event == "disk" then
- echo = ""
- lib.clearLine()
- lib.layout("Bastard. The mods will logblock you")
- lib.cursor(-1)
- elseif event == "rednet_message" and CheckID(param1) then
- local teamcolor, message = lib.tagView(param2)
- if message == "Snow" then
- hotBox(teamcolor.." started the snow repair")
- Snow()
- elseif message == "force" then
- hotBox(teamcolor.." forced start the game")
- lib.send(IDRedDoor, "Open")
- lib.send(IDBlueDoor, "Open")
- elseif message == "ResetMatch" then
- --Scoreboard FreeForAll reset
- elseif message == "ready" then
- hotBox("Team "..teamcolor.." is ready")
- lib.send(IDBlueMonitor, teamcolor.."Ready")
- lib.send(IDRedMonitor, teamcolor.."Ready")
- elseif message == "Button pushed" then
- hotBox(teamcolor.." button was pushed. Attempting to repair")
- Snow()
- end
- end
- end
- function Snow()
- lib.send(IDSnowGenerate, "Start")
- lib.send(IDSnowSpread, "Start")
- Hot4 = "Admin console started engines"
- hotBox()
- end
- function Busy()
- lib.send(IDBlue, "Busy")
- lib.send(IDRed, "Busy")
- end
- function Busy()
- lib.send(IDBlue, "Not Busy")
- lib.send(IDRed, "Not Busy")
- end
- --Now in control mode
- function Welcome()
- BlueReady = false
- RedReady = false
- lib.Clear()
- lib.fillLine()
- lib.layout("Welcome to the admin console")
- lib.fillLine()
- lib.layout()
- lib.layout("Press 1. to repair, 2. To start a match")
- lib.layout("3. To stop the match, 4. To start a tournament")
- lib.layout("5. Stop the doors and repair from working")
- lib.layout("6. Delete high scores, 7. Stop the tournament")
- lib.layout()
- lib.fillLine("X")
- lib.layout("X")
- lib.layout("X")
- lib.layout("X")
- lib.fillLine("X")
- hotBox()
- while true do
- event,param1 = os.pullEvent()
- if event == "char" then
- if param1 == "1" then
- Snow()
- elseif param1 == "2" then
- BeginMatch()
- break
- elseif param1 == "3" then
- StopMatch()
- break
- elseif param1 == "4" then
- StartTourny()
- break
- elseif param1 == "5" then
- LockDown()
- break
- elseif param1 == "6" then
- lib.send(IDBlueMonitor, "DeleteScore")
- lib.send(IDRedMonitor, "DeleteScore")
- hotBox("Admin console deleted High Score")
- elseif param1 == "7" then
- StopTourny()
- break
- end
- elseif event == "rednet_message" then
- end
- end
- end
- function StartTourny()
- lib.Clear()
- lib.fillLine()
- lib.layout("Welcome to the Tourny maker")
- lib.fillLine()
- lib.layout()
- lib.layout()
- lib.layoutOrder("Number of teams: ")
- local x,y = term.getCursorPos()
- term.setCursorPos(23,y-1)
- GamesNo = lib.readLimit(3)
- lib.cursor(1)
- lib.layoutOrder("Number of rounds per game: ")
- local x,y = term.getCursorPos()
- term.setCursorPos(33,y-1)
- RoundsNo = lib.readLimit(1)
- lib.cursor(1)
- repeat
- term.setCursorPos(1, 8)
- lib.layoutOrder("Deathmatch or Timetrials: ")
- local x,y = term.getCursorPos()
- term.setCursorPos(32, y-1)
- StyleNo = lib.readLimit(10)
- lib.cursor(1)
- until StyleNo == "Deathmatch" or StyleNo == "Timetrials"
- if StyleNo == "Timetrials" then
- lib.layoutOrder("How long should each round be: ")
- local x,y = term.getCursorPos()
- term.setCursorPos(37,y-1)
- TimeNo = lib.readLimit(1)
- lib.cursor(1)
- end
- Tourny()
- end
- function Tourny()
- --Write stuff to tell the screen
- lib.send(IDBlueMonitor, "Tourny")
- lib.send(IDRedMonitor, "Tourny")
- lib.Clear()
- lib.fillLine()
- lib.layout("Tourny Mode")
- lib.fillLine()
- lib.layout()
- lib.layout()
- lib.layout("Welcome to Tourny Mode, Press \"S\" to start the tourny")
- lib.layout("You can also press \"B\" to assign one point to blue team")
- lib.layout("Or press \"R\" to assign a point to red team")
- lib.layout("Please dont terminate the program..")
- lib.fillLine()
- hotBox("Entered Tourny Mode")
- while true do
- event,param1,param2 = os.pullEvent()
- if event == "rednet_message" then
- if CheckID(param1) then
- if param2 == "Red ready" then
- RedReady = true
- hotBox("Red signaled they are ready")
- lib.send(IDBlueMonitor, "RedReady")
- lib.send(IDRedMonitor, "RedReady")
- elseif param2 == "Blue ready" then
- BlueReady = true
- hotBox("Blue signaled they are ready")
- lib.send(IDBlueMonitor, "BlueReady")
- lib.send(IDRedMonitor, "BlueReady")
- elseif param2 == "Red repair" then
- hotBox("Red tried to repair. Denied")
- lib.send(IDRed, "Denied")
- elseif param2 == "Blue repair" then
- hotBox("Blue tried to repair. Denied")
- lib.send(IDBlue, "Denied")
- elseif param2 == "Red force" then
- hotBox("Red tried to force start. Denied")
- lib.send(IDRed, "Denied")
- elseif param2 == "Blue force" then
- hotBox("Blue tried to force start. Denied")
- lib.send(IDBlue, "Denied")
- elseif lib.tagView(param2) == "Team" then
- local a,s,d = lib.tagView(param2)
- hotBox("Team "..s.." picked team name: "..d)
- lib.send(IDBlueMonitor, param2)
- lib.send(IDRedMonitor, param2)
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment