Advertisement
Guest User

userLogon

a guest
Mar 2nd, 2018
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1.  
  2. local userInterface = {}
  3.  
  4.  
  5.  
  6. function userInterface.init(side,ranks)
  7.     userInterface.ranks = ranks
  8.     rednet.open(side)
  9.     rednet.broadcast("userServer")
  10.     senderID,message = rednet.receive(10)
  11.    
  12.     userInterface.serverID = senderID
  13.    
  14. end
  15.  
  16. function userInterface.login(user,pass)
  17.    
  18.     rednet.send(userInterface.serverID,"auth "..user.." "..pass.." "..userInterface.ranks)
  19.    
  20.     senderID,message = rednet.receive(10)
  21.    
  22.     if message == "Correct" then
  23.         print("Logged in")
  24.     else
  25.         print(message)
  26.     end
  27.    
  28. end
  29.  
  30.  
  31.  
  32.  
  33. userInterface.init("top","owner,admin,mod")
  34.  
  35. while true do
  36.     term.clear()
  37.     term.setCursorPos(1,1)
  38.     print("========User Logon=========")
  39.     print("Version: 1.0")
  40.     print("Username: ")
  41.     local username = read()
  42.     print("Password: ")
  43.     local pass = read("*")
  44.    
  45.     userInterface.login(username,pass)
  46.  
  47. sleep(1)    
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement