Advertisement
CharlieWho

Custom Login System Built Off ntnick

Mar 24th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. colored = true
  2.  
  3. if term.isColour() then
  4. print("Terminal is colored.")
  5. sleep(.1)
  6. colored = true
  7. else
  8. error("Terminal not colored.")
  9. end
  10.  
  11. password = {
  12. username = "Guest";
  13. password = "1234";
  14. }
  15.  
  16. function SPixel(x,y,color)
  17. term.setCursorPos(x,y); term.setTextColour(color)
  18. term.setBackgroundColour(color); term.write("d")
  19. term.setTextColour(colours.white); term.setBackgroundColour(colours.black)
  20. end
  21.  
  22. function SPixelText(x,y,color,textcol,b)
  23. term.setCursorPos(x,y); term.setTextColour(textcol)
  24. term.setBackgroundColour(color); term.write(b)
  25. term.setTextColour(colours.white); term.setBackgroundColour(colours.black)
  26. end
  27.  
  28. term.clear()
  29. term.setCursorPos(1,1)
  30.  
  31. function login_colored()
  32. term.clear()
  33. term.setCursorPos(1,1)
  34. for i=1, 51 do
  35. SPixel(i,1,colours.grey)
  36. end
  37. SPixelText(1,1,colours.grey,colours.white,"Login System Made By ntnick")
  38. term.setCursorPos(1,2)
  39. io.write("Username: ")
  40. local uName = read()
  41. io.write("Password: ")
  42. local pWord = read("*")
  43. if(uName == password.username and pWord == password.password) then
  44. term.clear()
  45. term.setCursorPos(1,1)
  46. return
  47. elseif(uName ~= password.username and pWord ~= password.password) then
  48. term.setCursorPos(1,19)
  49. SPixelText(1,19,colours.black,colours.red,"Wrong password. Redirecting...")
  50. sleep(2)
  51. login_colored()
  52. end
  53. end
  54.  
  55. login_colored()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement