Guest User

login

a guest
Jul 12th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. local oldPull = os.pullEvent
  2. os.pullEvent = os.pullEventRaw
  3. -- Above, getting rid of those pesky terminate "hackers"
  4. -- Below, defining accounts and passwords
  5. local a = {
  6. a1 = "Brodur",
  7. a2 = "Hard24get"
  8. }
  9. -- I'd like to condense these in the future if possible --
  10.  
  11. local p = {
  12. p1 = "qwerty25",
  13. p2 = "blackmesa",
  14. }
  15.  
  16. term.clear()
  17. term.setCursorPos(1,1)
  18. print("Welcome to the MesaNet, running on BroDOS!")
  19. sleep(0.5)
  20. term.setCursorPos(1,3)
  21.   print("Username: ")
  22.   print("Password: ")
  23. sleep(0.5)
  24. term.setCursorPos(11,3)
  25. input = read()  -- Entering username --
  26. if input==(a.a1) then --Does the account even exist? if so, continue!--
  27.   term.setCursorPos(11,4)
  28. elseif input==(a.a2) then
  29.   term.setCursorPos(11,4)
  30. elseif input=="I give up" then -- Self explanatory --
  31. os.reboot()
  32. else
  33.   term.clearLine()
  34.   print("No such account!")
  35.   sleep(1)
  36.   shell.run(login)
  37. end
  38.  
  39. code = read("*") -- Seeing if accounts and passwords match, if they do, login! --
  40. if code==p.p1 and input==a.a1 then
  41.   print(" ")
  42.   print("Welcome "..a.a1.."!")
  43.  
  44. elseif code==(p.p2) and input==(a.a2) then
  45.   print(" ")
  46.   print("Welcome "..a.a2.."!")
  47. else
  48.   print("Invalid password!")
  49.   sleep(1)
  50.   shell.run("login")
  51. end
  52. os.pullEvent = oldPull -- Resetting pullEvent --
Advertisement
Add Comment
Please, Sign In to add comment