Advertisement
jille_Jr

CC: Login Script

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