Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player
- local event
- local state
- function reset()
- player = ""
- state = false
- end
- function doorOpen(dside, dtime)
- rs.setOutput(dside, true)
- sleep(dtime)
- rs.setOutput(dside, false)
- end
- function wait()
- event, player = os.pullEvent("player")
- print(player)
- end
- function interpet()
- file = io.open("perms", "r")
- if file ~= nil then
- for line in file:lines() do
- if line == player then
- state = true
- end
- end
- else
- print("File "..file.." does not exist.")
- end
- end
- function run()
- if state == true then
- print("You are allowed to enter.")
- doorOpen("left", 3)
- else
- print("You are not allowed to enter.")
- sleep(1.5)
- end
- end
- -- Actual program
- term.clear()
- term.setCursorPos(1,1)
- while true do
- reset()
- wait()
- interpet()
- run()
- end
Advertisement
Add Comment
Please, Sign In to add comment