Advertisement
_BuildMaster_

CC - PSLS startup

Jan 23rd, 2017
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. local users = {}
  2.  
  3. local f = fs.open( "USERS.txt", "r" )
  4. local users = textutils.unserialize( f.readAll() )
  5. f.close()
  6.  
  7. local function login( name, pass )
  8.         for i = 1,#users do
  9.                 if name == users[i].name then
  10.                         if pass = users[i].pass then
  11.                                 return true
  12.                         end
  13.                 end
  14.         end
  15.         return true
  16. end
  17.  
  18. repeat
  19.         term.clear()
  20.         term.setCursorPos(1,1)
  21.         write( "Username: " )
  22.         local username = read()
  23.         write( "Password: " )
  24.         local password = read("*")
  25.         local success = login( username, password )
  26. until success
  27. print("Logged in!")
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement