Advertisement
Guest User

Security

a guest
Oct 10th, 2018
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.75 KB | None | 0 0
  1. Proximity = rs.getAnalogInput("left")
  2.  
  3. os.pullEvent = os.pullEventRaw
  4.  
  5. function Security()
  6.     if Proximity == 5
  7.         then sleep(1)
  8.             else os.reboot()
  9.                 end
  10.                     term.setTextColor(colors.cyan)
  11.                     print("Please Provide Security Key")
  12.                     print(" ")
  13.                     print("Password:")
  14.                     password = io.read()
  15.                         if password == "TestPass" and Proximity == 5
  16.                             then
  17.                                 term.clear()
  18.                                 term.setCursorPos(1,1)
  19.                                 term.setTextColor(colors.green)
  20.                                 print("Security Key Accepted")
  21.                                 print(" ")
  22.                                 print("Access Granted")
  23.                                 redstone.setOutput("right", true)
  24.                                 sleep(10)
  25.                                 redstone.setOutput("right", false)
  26.                                     else
  27.                                         term.setTextColor(colors.red)
  28.                                         print("User or Security Key is Invalid.")
  29.     Security()
  30.                                             end
  31.  
  32. function Authentication()
  33.     if Proximity == 5
  34.         then sleep(1)
  35.             else os.reboot()
  36.                 end
  37.                     term.clear()
  38.                     term.setCursorPos(1,1)
  39.                     term.setTextColor(colors.cyan)
  40.                     print("Welcome. Please input User Identification Key")
  41.                     print(" ")
  42.                     print("User ID:")
  43.                     username = io.read()
  44.                         if username == "TestName" and Proximity == 5
  45.                             then
  46.                                 term.clear()
  47.                                 term.setCursorPos(1,1)
  48.                                 term.setTextColor(colors.green)
  49.                                 print("User Identification Key Accepted")
  50.                                 print(" ")
  51.                                 sleep(1)
  52.                                 term.setTextColor(colors.purple)
  53.                                 print("Welcome.")
  54.     Security()
  55.                                     else
  56.                                         term.setTextColor(colors.red)
  57.                                         print("Invalid User. Session Terminated.")
  58.                                         sleep(1)
  59.     os.reboot()
  60.                                             end
  61.  
  62. function Start()
  63.     term.clear()
  64.     term.setCursorPos(1,1)
  65.     term.setTextColor(colors.cyan)
  66.     sleep(1)
  67.         if Proximity == 5
  68.             then sleep (1)
  69.                 Security()
  70.                     end
  71.     end
  72.  
  73. Start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement