Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- os.pullEvent = os.pullEventRaw
- local w,h = term.getSize()
- local dSide = "right"
- local sID = 90
- local rSide = "back"
- local uAllow = false
- local pAllow = false
- function clear() term.clear() term.setCursorPos(1,1) end
- local function uInput()
- write("Username: ")
- uInput = read()
- rednet.send(sID, uInput)
- uId, uMsg = rednet.receive(2)
- if uId == sID and uMsg == "uAllow" then
- uAllow = true
- else
- print("Incorrect Username!")
- sleep(2)
- os.reboot()
- end
- end
- local function pInput()
- write("Password: ")
- pInput = read("*")
- rednet.send(sID, pInput)
- pId, pMsg = rednet.receive(2)
- if pId == sID and pMsg == "pAllow" then
- pAllow = true
- else
- print("Incorrect Password!")
- sleep(2)
- os.reboot()
- end
- end
- local function printCentered(str, h)
- term.setCursorPos(w/2 - #str/2, h)
- write(str)
- end
- local function drawHeader()
- clear()
- printCentered("Sammich Login", 1)
- end
- rednet.open(rSide)
- drawHeader()
- term.setCursorPos(1,5)
- uInput()
- if uAllow == true then
- term.setCursorPos(1,6)
- pInput()
- end
- if uAllow and pAllow == true then
- redstone.setOutput(dSide, true)
- sleep(5)
- redstone.setOutput(dSide, false)
- rednet.close(rSide)
- os.reboot()
- end
Add Comment
Please, Sign In to add comment