Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- DiabolusNeil's Player Detected Door Lock | CC 1.53
- -- Requires MiscPeripherals Player Detector touching the computer
- local player
- local event
- local state
- -- Changeable variables
- local dside = "left" -- Door Side
- local dtime = 4 -- Seconds door is open
- local reference = "permissions" -- Name of program that holds all allowed names
- function clear()
- term.clear()
- term.setCursorPOs(1,1)
- end
- function reset()
- player = ""
- state = false
- end
- function openDoor(side, time)
- rs.setOutput(fside, true)
- sleep(ftime)
- rs.setOutput(fside, false)
- end
- function wait()
- event, player = os.pullEvent("player")
- print(player)
- end
- function interpet(refer)
- file = io.open(refer, "r")
- if file ~= null then
- for line in file:lines() do
- if name == line then
- state = true
- end
- end
- end
- end
- function run()
- if state == true then
- print("You are allowed to enter.\n")
- openDoor(dside, dtime)
- else
- print("You are not allowed to enter.\n")
- sleep(2)
- end
- end
- -- Actual Program
- clear()
- while true do
- write("Player Detected: ")
- reset()
- wait()
- interpet(reference)
- run()
- end
Advertisement
Add Comment
Please, Sign In to add comment