Advertisement
Guest User

main

a guest
May 21st, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. loggedin = false;
  2. local user = "null";
  3. users = {["werty"] = "Werty", ["human"] = "hi"};
  4.  
  5. term.setTextColor(colors.green);
  6. textutils.slowPrint("Welcome to Human-OS");
  7.  
  8. term.setTextColor(colors.orange);
  9.  
  10. term.setTextColor(colors.green);
  11.  
  12. textutils.slowPrint("Login:");
  13. term.setTextColor(colors.blue);
  14. textutils.slowPrint("  Username:");
  15. term.setTextColor(colors.red);
  16. local username = read();
  17. term.setTextColor(colors.blue);
  18. textutils.slowPrint("  Password:");
  19. term.setTextColor(colors.red);
  20. local password = read("*");
  21.  
  22. function check(u, p)
  23.  
  24.   if users[u] == p then
  25.    loggedin = true;  
  26.    user = u;
  27.    return true;
  28.   end
  29. end
  30.  
  31. if check(username, password) then
  32.   term.setTextColor(colors.green);
  33.   term.clear();
  34.   textutils.slowPrint("Welcome back " .. user);
  35.   os.sleep(3);
  36.   term.clear();
  37.   term.setCursorPos(1, 1);
  38. else
  39.   term.clear();
  40.   term.setCursorPos(1, 1);
  41.   term.setTextColor(colors.red);
  42.   textutils.slowPrint("Login information was incorrect!");
  43.   shell.run("startup");
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement