Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- function main ()
- local detector = peripheral.find("playerDetector")
- parallel.waitForAny(
- -- physical
- function ()
- while true do
- -- player input
- term.clear()
- term.setCursorPos(1, 1)
- print ("Password: ")
- input = read("*")
- if input == "open" then
- redstone.setOutput("bottom", true)
- sleep(3)
- redstone.setOutput("bottom", false)
- end
- end
- end,
- -- player detector
- function ()
- while true do
- local playerInRange = function (range)
- local players = detector.getPlayersInRange(range)
- return #players > 0
- end
- if detector ~= nil then
- if playerInRange(6) then
- redstone.setOutput("bottom", true)
- else
- redstone.setOutput("bottom", false)
- end
- end
- end
- end
- )
- end
- if args[1] == "update" then
- shell.run("pastebin", "run", "FuQ3WvPs f6Y3M1MP playerDetectorLock")
- else
- peripheral.wrap("top")
- main()
- end
Add Comment
Please, Sign In to add comment