TheCryptek

[LUA] AccessClient

Aug 12th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. --[[ Client side: Lock ]]--
  2.  
  3. os.pullEvent = os.pullEventRaw
  4.  
  5. rednet.open("back")
  6. local serverId = 3
  7. local myId = os.computerID()
  8.  
  9. while true do
  10.     term.clear()
  11.     term.setCursorPos(1,1)
  12.     write("Password:")
  13.     local password = read("*")
  14.     term.clear()
  15.     term.setCursorPos(1,1)
  16.  
  17.     if password == "Admin" then
  18.         break
  19.     else
  20.         rednet.send(serverId,password)
  21.         local senderId, message = rednet.receive(5)
  22.         if senderId == serverId and message == "Valid" then
  23.             print("Access Granted")
  24.             redstone.setOutput("right", true)
  25.             sleep(5)
  26.             redstone.setOutput("right", false)
  27.         end
  28.     end
  29. end
Add Comment
Please, Sign In to add comment