Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Wrapping of peripheral (Not sure if neccesary)
- ps = peripheral.wrap("player_detector_0")
- --Table of people alowed to use the door
- local allow =
- {
- "TechedZombie"
- }
- --Detects a touch and returns the player who touched it
- function getTouch()
- local event, side, name = os.pullEvent("player")
- print (name)
- return name
- end
- --Compares the name to list of USERS
- function checkName(name)
- for i = 1, table.getn(allow) do
- if name == allow[i] then
- return true
- end
- end
- return false
- end
- --Opens the door for a few seconds
- function door()
- redstone.setOutput("right", false)
- sleep(3)
- redstone.setOutput("right", true)
- end
- --Main loop
- while true do
- local name = getTouch()
- local boolAllow = checkName(name)
- if boolAllow == true then
- door()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement