Advertisement
tryy3

CC inlog system

Jul 25th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.82 KB | None | 0 0
  1.  
  2. -----------------------------------
  3. --      Log in system v 1.0      --
  4. --         Made by tryy3         --
  5. --    All credits goes to him    --
  6. --Please dont delete this comment--
  7. -----------------------------------
  8. os.pullEvent = os.pullEventRaw -- Makes it not possible to do ctrl + T!
  9. textutils.slowPrint("\nStarting login program") -- Random Texts
  10. sleep(1) -- makes the code sleep 1 sec
  11. textutils.slowPrint("Starting background programs") -- Random texts
  12. sleep(1) -- makes the code sleep 1 sec
  13. textutils.slowPrint("Preparing everything") -- Random Texts
  14. sleep(1) -- makes the code sleep 1 sec
  15. textutils.slowPrint("Loading...") -- Random Texts
  16. sleep(5) -- makes the code sleep 5 sec
  17. term.clear() -- clears the terminal
  18.  
  19. --Credits, name and version of this program
  20. textutils.slowPrint("***********************")
  21. textutils.slowPrint("* Log in system v 1.0 *")
  22. textutils.slowPrint("*    Made by tryy3    *")
  23. textutils.slowPrint("***********************\n")
  24.  
  25. -- Function for the Username
  26. local function checkUsername(username)
  27.     if username == "Username" then
  28.         return true
  29.     else
  30.         return false
  31.     end
  32. end
  33.  
  34. -- Function for the Password
  35. local function checkPassword(password)
  36.     if password == "Password" then
  37.         return true
  38.     else
  39.         return false
  40.     end
  41. end
  42.  
  43.  
  44. for i=1,3 do -- Makes it possible to give you 3 trys!
  45.     textutils.slowPrint ("Enter your username!") -- Prints out to let you know that, now you can write the username!
  46.     username = read() -- Makes it possible for the code to read what you type!
  47.  
  48.     if checkUsername(username) == false then -- Checks if you typed wrong username
  49.         textutils.slowPrint("Incorrect username!\n") -- Prints out that you typed wrong username!
  50.  
  51.     elseif checkUsername(username) == true then -- Checks if your Username is correct!
  52.         textutils.slowPrint ("Enter your password!") -- Prints out to let you know that, now you can write the password!
  53.         password = read("*") -- Makes it possible for the code to read what you type!
  54.  
  55.         if checkPassword(password) == true then -- Checks if your password is correct!
  56.             textutils.slowPrint ("Login correct!") -- Prints out that you typed the password correct!
  57.             rs.setOutput("back", true) -- Sends a redstonje signal at the back of the terminal, and if the username is correct!
  58.             sleep(3) -- Nakes the code sleep for 3 sec!
  59.             rs.setOutput("back", false) -- Because its false, this code will just prevent the code for sending a redstone signal, if you typed the password wrong!
  60.         else
  61.             textutils.slowPrint ("Incorrect password!\n") -- Prints out that you typed wrong password!
  62.         end
  63.     end
  64. end
  65. print("Shutdown for 15s.") -- Tells you that the program shuts off your terminal
  66. os.sleep(15) -- Makes the code sleep for 15 sec
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement