Advertisement
Ranger1230

DoorComand

Jun 1st, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. function getInput(message)
  2.   io.write(message)
  3.   io.flush()
  4.   local userInput = io.read()
  5.   return userInput;
  6. end
  7.  
  8. function openDoor()
  9.   local component = require("component")
  10.   local redstone = component.redstone
  11.  
  12.   redstone.setOutput(require("sides").bottom, 15)
  13. end
  14.  
  15. function auth(password)
  16.   local userInput = getInput("Please Enter Password...")
  17.   if userInput == password then
  18.     return true
  19.   else
  20.     io.write("Password Incorrect")
  21.     io.flush()
  22.     return false
  23.   end
  24. end
  25.  
  26. if auth("Please!") then
  27.   openDoor()
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement