Advertisement
Guest User

startup

a guest
Feb 14th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.93 KB | None | 0 0
  1. function c()
  2.   term.clear()
  3.   term.setCursorPos(1, 1)
  4. end
  5.  
  6. local password = "onesmallstepforman"
  7. local uPassword
  8. local NASAID
  9. local guestUsername
  10. local guestPassword = "12345"
  11. local success = false
  12.  
  13. print("Welcome to the NASA space center.")
  14. print("Please know that your login information is")
  15. print("being tracked as you move throughout the building.")
  16. print(" ")
  17. term.write("Enter your NASAID: ")
  18. NASAID = read()
  19. c()
  20.  
  21. print("Verifying NASAID...")
  22. os.sleep(3)
  23. c()
  24.  
  25. if NASAID == "guest" then
  26. --IF guest
  27.   print("Welcome guest!")
  28.   os.sleep(1)
  29.   term.write("Please Enter your username for identification: ")
  30.   guestUsername = read()
  31.   c()
  32.   print("Hello, ".. guestUsername .. "!")
  33.   term.write("Please enter your guest password: ")
  34.   uPassword = read("*")
  35.   c()
  36.   print("Validating Password...")
  37.   if uPassword == guestPassword and uPassword ~= nil and guestUsername ~= nil then
  38.     --Correct Guest password
  39.     os.sleep(2)
  40.     c()
  41.     print("Sending login information...")
  42.     rednet.open("back")
  43.     success = rednet.send(10, "Guest, " .. guestName .. ", Validated!"
  44.     rednet.close("back")
  45.     os.sleep(2)
  46.     if success then
  47.     --Successful send
  48.       print("Success!")
  49.       rs.setOutput("right", true)
  50.       os.sleep(2)
  51.       rs.setOutput("right", false)
  52.       os.reboot()
  53.     else
  54.     --Unsuccessful send
  55.       print("ERROR! Please use another console and contact the control room immedeatley!")
  56.       os.sleep(2)
  57.       os.reboot()
  58.     end
  59.    
  60.   else
  61.   --Incorrect name or guest password
  62.     os.sleep(2)
  63.     c()
  64.     print("Your guest password or username seems to be invalid, please contact your chaperone!")
  65.     os.sleep(2)
  66.     os.reboot()
  67.   end
  68.  
  69. elseif NASAID ~= nil
  70. --NASAID is NOT guest
  71.   print("Welcome Back!")
  72.   term.write("Password: ")
  73.   uPassword == read("*")
  74.   c()
  75.   print("Validating Password...")
  76.   os.sleep(3)
  77.   c()
  78.   if uPassword == password
  79.     --Correct password
  80.     print("Sending Login Information...")
  81.     os.sleep(2)
  82.     rednet.open("back")
  83.     success = rednet.send(10, "User, " .. NASAID .. ", Success!")
  84.     rednet.close("back")
  85.     if success then
  86.       --Successful send
  87.       print("Success!")
  88.       rs.setOutput("right", true)
  89.       os.sleep(2)
  90.       rs.setOutput("right", false)
  91.       os.reboot()
  92.     else
  93.     --Unsuccessful Send
  94.       print("ERROR! Please contact security immedeatly!")
  95.       os.sleep(2)
  96.       os.reboot()
  97.     end
  98.    
  99.   else
  100.     print("Incorrect Password!")
  101.     os.seep(2)
  102.     c()
  103.     print("Sending Login Information...")
  104.     os.sleep(2)
  105.     rednet.open("back")
  106.     rednet.send(10, "User, " .. NASAID .. ", INCORRECT PASSWORD!")
  107.     rednet.close("back")
  108.     c()
  109.     print("Your incorrect password attempt has been recorded!")
  110.     print("Goodbye!")
  111.     os.sleep(2)
  112.     os.reboot()
  113.   end
  114.  
  115. else
  116.   --NASAID was not entered
  117.   print("Please enter a valid NASAID!")
  118.   os.sleep(2)
  119.   os.reboot()
  120. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement