Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- function LoadWifi()
- local listOfSides = rs.getSides()
- local listofPossibles = {}
- local counter1 = 0
- while true do
- counter1 = counter1 + 1
- if peripheral.isPresent(tostring(listOfSides[counter1])) and peripheral.getType(listOfSides[counter1]) == "modem" then
- table.insert(listofPossibles,tostring(listOfSides[counter1]))
- end
- if counter1 == 6 and table.maxn(listofPossibles) == 0 then
- return nil
- end
- if counter1 == 6 and table.maxn(listofPossibles) ~= 0 then
- rednet.open(listofPossibles[1])
- return listofPossibles[1]
- end
- end
- end
- function LoadDiskDrive()
- local listOfSides = rs.getSides()
- local listOfPossibles = {}
- local counter = 0
- while true do
- counter = counter + 1
- if peripheral.isPresent(tostring(listOfSides[counter])) and peripheral.getType(listOfSides[counter]) == "drive" then
- table.insert(listOfPossibles,tostring(listOfSides[counter]))
- end
- if counter == 6 and table.maxn(listOfPossibles) == 0 then
- return nil
- end
- if counter == 6 and table.maxn(listOfPossibles) ~= 0 then
- return listOfPossibles[1]
- end
- end
- end
- function LoadPrinter()
- local listOfSides = rs.getSides()
- local listOfPossibles = {}
- local counter = 0
- while true do
- counter = counter + 1
- if peripheral.isPresent(tostring(listOfSides[counter])) and peripheral.getType(listOfSides[counter]) == "printer" then
- table.insert(listOfPossibles,tostring(listOfSides[counter]))
- end
- if counter == 6 and table.maxn(listOfPossibles) == 0 then
- return nil
- end
- if counter == 6 and table.maxn(listOfPossibles) ~= 0 then
- return listOfPossibles[1]
- end
- end
- end
- function Welcome()
- term.clear()
- term.setCursorPos(1,1)
- print("Welcome " .. username)
- end
- modemOn = LoadWifi()
- DiskDriveOn = LoadDiskDrive()
- PrinterOn = LoadPrinter()
- term.clear()
- term.setCursorPos(1,1)
- if modemOn == nil then
- term.setTextColor(colors.red)
- print("No Wifi Modem")
- term.setTextColor(colors.white)
- else
- term.setTextColor(colors.green)
- print("Connected to wifi")
- print("Opened wifi on " .. modemOn .. " side")
- term.setTextColor(colors.white)
- end
- if DiskDriveOn == nil then
- term.setTextColor(colors.red)
- print("no disk drive")
- term.setTextColor(colors.white)
- else
- term.setTextColor(colors.green)
- print("Opened disk drive on " .. DiskDriveOn .. " side")
- term.setTextColor(colors.white)
- end
- if PrinterOn == nil then
- term.setTextColor(colors.red)
- print("No printer")
- term.setTextColor(colors.white)
- else
- term.setTextColor(colors.green)
- print("Printer found on " .. PrinterOn .. " side")
- term.setTextColor(colors.white)
- end
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- local loadicon = paintutils.loadImage("loadicon")
- paintutils.drawImage(loadicon, 3, 5)
- sleep(1)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- local x, y = term.getSize()
- for yPos = 1, y do
- term.setBackgroundColor(colors.gray)
- term.setCursorPos(1, yPos)
- for xPos = 1, x do
- print(" ")
- end
- end
- term.setTextColor(colors.white)
- local w, h = term.getSize()
- term.setCursorPos(w / 2 - 11 / 2, 3)
- print("OpenGate Os")
- function drawTextBar()
- term.setBackgroundColor(colors.white)
- local wT1, hT1 = term.getSize() / 2 - 5
- local wT2, hT2 = term.getSize() / 2 + 5
- term.setCursorPos(wT1,5)
- for w = wT1, wT2 do
- write(" ")
- end
- term.setCursorPos(wT1,7)
- for w = wT1, wT2 do
- write(" ")
- end
- end
- while true do
- local wT1, hT1 = term.getSize() / 2 - 5
- local wT2, hT2 = term.getSize() / 2 + 5
- term.setCursorPos(wT1,5)
- drawTextBar()
- term.setTextColor(colors.black)
- term.setCursorPos(w / 2 - 5, 5)
- user = read()
- term.setCursorPos(w / 2 - 5, 7)
- pass = read("*")
- if user == "pete456" and pass == "shit" then
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(1,1)
- term.clear()
- print("Welcome pete456")
- break
- else
- term.setBackgroundColor(colors.gray)
- term.setCursorPos(1,1)
- term.setTextColor(colors.red)
- print("Incorrect username or password")
- term.setTextColor(colors.white)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement