Guest User

Untitled

a guest
Oct 20th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. x1,y1 = term.getSize()
  2. local user = ""
  3. local password = ""
  4.  
  5. --Gui
  6.  
  7. function clear()
  8.  term.setCursorPos(1,1)
  9.  term.clear()
  10. end
  11.  
  12. function Border()
  13.  for i= 1,6 do
  14.   term.setCursorPos(1,0+i)
  15.   write("|")
  16.  end
  17.  term.setCursorPos(1,2)
  18.  for i= 1,x1-1 do
  19.   write("-")
  20.  end
  21.  term.setCursorPos(1,5)
  22.  for i= 1,x1-1 do
  23.   write("-")
  24.  end
  25.  term.setCursorPos(1,7)
  26.  for i= 1,x1-1 do
  27.   write("-")
  28.  end
  29.   term.setCursorPos(x1-1,1)
  30.  write("|")
  31.  term.setCursorPos(x1-1,6)
  32.  write("|")
  33.  
  34.  
  35. end
  36.  
  37. function Text()
  38.  term.setCursorPos(3,1)
  39.  print("ZeusOs")
  40.  term.setCursorPos(3,3)
  41.  write("User      | ")
  42.  term.setCursorPos(3,4)
  43.  write("Password  | ")
  44. end
  45.  
  46. function Gui()
  47.  clear()
  48.  Border()
  49.  Text()
  50. end
  51.  
  52. while true do
  53.  Gui()
  54.  term.setCursorPos(15,3)
  55.  user = read()
  56.  term.setCursorPos(15,4)
  57.  password = read("*")
  58.  if fs.exists("data/users/"..user) then
  59.   file = fs.open("data/users/"..user,"r")
  60.   confirm = file.readAll()
  61.   file.close()
  62.   if password == confirm then
  63.    term.setCursorPos(3,6)
  64.    print("Welcome Back!")
  65.    sleep(1)
  66.    shell.run("Startup")
  67.   else
  68.    term.setCursorPos(3,6)
  69.    print("Wrong user or password!")
  70.    sleep(1)
  71.   end
  72.  else
  73.   term.setCursorPos(3,6)
  74.   print("User Doesnt Exist")
  75.   sleep(1)
  76.  end
  77. end
  78.  
  79. -- Kz0es6CA
Add Comment
Please, Sign In to add comment