Guest User

.password

a guest
Oct 9th, 2012
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. local oldPull = os.pullEvent;
  2. os.pullEvent = os.pullEventRaw;
  3.  
  4. function checkLogin(pass)
  5.   -- Yes, very easy to hack...
  6.   if pass == "butler" then
  7.         return true
  8.   else
  9.         return false
  10.   end
  11. end
  12.  
  13. function login()
  14.   local inputPass = ""
  15.  
  16.   while not checkLogin(inputPass) do
  17.         term.clear()
  18.         if inputPass ~= "" then
  19.           term.setCursorPos(3,2)
  20.           print("Wrong password!")
  21.         end
  22.         term.setCursorPos(3,3)
  23.         print("Password: ") -- 10 char long
  24.        
  25.         -- Now comes the input
  26.         term.setCursorPos(13,3)
  27.         inputPass = read("*")
  28.   end
  29.   term.clear()
  30.   term.setCursorPos(3,2)
  31.   print("Correct password!")
  32.   sleep(1.5)
  33.   term.clear()
  34.   term.setCursorPos(1,1)
  35. end
  36.  
  37. login()
  38.  
  39. os.pullEvent = oldPull;
Advertisement
Add Comment
Please, Sign In to add comment