Bimgo

CC-Lock door with server support

Feb 18th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. local done = false
  3. local myid = os.computerID()
  4.  
  5. while done == false do
  6.   write("Password:")
  7.   local password = read()
  8.   term.clear()
  9.   term.setCursorPos(1,1)
  10.  
  11.   rednet.open("back")
  12.   rednet.send(ID_OF_SERVER, password)
  13.   serverID, message, distance = rednet.receive()
  14.   rednet.close("back")  
  15.  
  16.   isValid = message
  17.  
  18.   if isValid == -1 then
  19.     print("You are not allowed to use this channel")
  20.   elseif isValid == 1  then
  21.     print("Access Granted")
  22.     redstone.setOutput("right",true)
  23.     sleep(5)
  24.     redstone.setOutput("right",false)
  25.   else
  26.     print("Wrong password")
  27.     sleep(2)
  28.    
  29.   end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment