Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- os.loadAPI("ugapi")
- os.loadAPI("sha256")
- os.loadAPI("logapi")
- rednet.open(logapi.getModemSide())
- local protocol = ""
- local it = ".simg"
- local w, h = term.getSize()
- local scp = term.setCursorPos
- local sbc = term.setBackgroundColor
- local stc = term.setTextColor
- function notify(title,txt,txtone,txttwo)
- local w, h = term.getSize()
- paintutils.drawBox(
- (w/2) - 9, (h/2) - 2, (w/2)+12, (h/2)+2,
- colors.black)
- paintutils.drawFilledBox(
- (w/2) - 10, (h/2) - 3, (w/2)+11, (h/2)+1,
- colors.lightGray)
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.white)
- paintutils.drawLine((w/2)-10,(h/2)-3,(w/2)+11,(h/2)-3)
- term.setCursorPos((w/2)-10,(h/2)-3)
- write(title)
- term.setBackgroundColor(colors.lightGray)
- term.setCursorPos((w/2)-10,(h/2)-2)
- write(txt)
- term.setCursorPos((w/2)-10,(h/2)-1)
- write(txtone)
- term.setCursorPos((w/2)-10,(h/2))
- write(txttwo)
- os.pullEvent("key")
- end
- function ui()
- ugapi.bcolor(colors.lightBlue)
- term.clear()
- ugapi.drawimage(it,2,1)
- scp(13,5)
- stc(colors.white)
- sbc(colors.blue)
- write("Please sign in to continue. ")
- sbc(colors.lightGray)
- scp(14,10)
- write("User: ")
- scp(14,12)
- write("Pass: ")
- scp(20,10)
- stc(colors.black)
- sbc(colors.white)
- local uname = read()
- scp(20,12)
- local upass = read("*")
- local isvalid = logapi.checkLogin(protocol,uname,upass)
- if(isvalid == "no-connection")then notify("Login","Server connection has","been lost. ","") return ui() end
- if(isvalid == true)then
- notify("Login","Access granted.","Press any key to","open door. ")
- rs.setOutput("left", true)
- sleep(2)
- rs.setOutput("left",false)
- ui()
- elseif(isvalid == false)then
- notify("Login","Unknown account or","invalid password. ","")
- ui()
- end
- end
- ui()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement