Advertisement
ndfjay

Magica Login

Jan 15th, 2013
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. local w,h = term.getSize()
  2.  
  3. os.pullEvent = os.pullEventRaw
  4.  
  5. local username = {
  6. "user1","user2","user3"
  7. }
  8.  
  9. local password = {
  10. "pass1","pass2","pass3"
  11. }
  12.  
  13. local function center(text, line)
  14.   term.setCursorPos(math.floor(w/2)-string.len(text)/2, line)
  15.   write(text)
  16. end
  17.  
  18. while true do
  19.   term.clear()
  20.   center("Magica Security INC", 1)
  21.   center(":=================:",2)
  22.   center("Copyright 2013",4)
  23.   center(":============:",5)
  24.   center(":==========:",8)
  25.   center("Username >> ",7)
  26.   input = read()
  27.   center(":==========:",10)
  28.   center("Password >> ",9)
  29.   pass = read("*")
  30.     for i,v in ipairs(username) do
  31.       if input == v then
  32.         if pass == password[i] then
  33.           term.clear()
  34.           center("Welcome "..tostring(input),2)
  35.           center(":===============:",3)
  36.           sleep(1)
  37.           rs.setOutput("bottom", true)
  38.           sleep(5)
  39.           rs.setOutput("bottom", false)
  40.           else
  41.             term.clear()
  42.             center("Incorrect details!",2)
  43.             center(":================:",3)
  44.             sleep(2)
  45.         end
  46.       end
  47.     end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement