Advertisement
JerryWester

[ComputerCraft] Login

Dec 21st, 2016
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. pullEventBack = os.pullEvent
  2. os.pullEvent = os.pullEventRaw
  3. term.clear()
  4. term.setCursorPos(1,1)
  5.  
  6. h = fs.open(".set", "r")
  7. settings = textutils.unserialize(h.readAll())
  8. h.close()
  9.  
  10. login = settings.login.login
  11. while login do
  12.    
  13.     term.clear()
  14.     term.setCursorPos(1,1)
  15.     print("Enter Credentials:")
  16.     term.setCursorPos(2,3)
  17.     print("Username:")
  18.     term.setCursorPos(2,5)
  19.     print("Password:")
  20.    
  21.     term.setCursorPos(12,3)
  22.     user = read()
  23.     term.setCursorPos(12,5)
  24.     pass = read("*")
  25.    
  26.     if user == settings.login.user and pass == settings.login.pass then
  27.         login = false
  28.     else
  29.         term.setCursorPos(1,7)
  30.         print("Incorrect username and/or password!!")
  31.         sleep(2)
  32.     end
  33. end
  34. os.pullEvent = pullEventBack
  35. shell.run(settings.general.menuDir)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement