Nyaar

[CC] Password Protected Computer

Jun 6th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.07 KB | None | 0 0
  1. local password=""              -- Change this to your password
  2. local cName="Name of Computer" -- Change this to the name of your
  3.                                -- computer
  4.  
  5. -- PASSWORD PROTECTED COMPUTER
  6. -- Version: 1.5
  7. -- Code by: Nyaar
  8. -- Notes: Make sure you create a
  9. --        password but don't edit
  10. --        anything below this line.
  11.  
  12. local w,h = term.getSize()
  13.  
  14. function printC(str, y)
  15.  term.setCursorPos(1,y)
  16.  term.clearLine()
  17.  term.setCursorPos(w/2 - #str/2, y)
  18.  term.write(str)
  19. end
  20.  
  21. function printLR(str, y)
  22.  term.setCursorPos(1,y)
  23.  term.clearLine()
  24.  term.setCursorPos(w/2 - #str/2, y)
  25.  term.write(str)
  26.  term.setCursorPos(1,y)
  27.  write("|")
  28.  term.setCursorPos(w-1,y)
  29.  write("|")
  30. end
  31.  
  32. function printLB(str, y)
  33.  term.setCursorPos(1, y)
  34.  print(string.rep(str, w-1))
  35. end
  36.  
  37. term.clear()
  38. term.setCursorPos(1,1)
  39. printLB("=",1)
  40. printLR(" ",2)
  41. printLR(cName,3)
  42. printLR("Status: Locked",4)
  43. printLR(" ",5)
  44. printLB("=",6)
  45. print("")
  46. write("            Password: ")
  47. local status, input = pcall(read,"*")
  48. if (input ~= password) then
  49.  os.reboot()
  50. end
Advertisement
Add Comment
Please, Sign In to add comment