Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chatBox = peripheral.wrap("left") --defines the side for the chatbox
- rs.setOutput("right", false) --sets the redstone signal on the right side to be off, place a door on this side
- acceptedUser = "Sandrino1"
- password = "password"
- chatBox.setDistance(4)
- while true do
- local event, side, name, message = os.pullEvent("chat_message") -- defines the names of all the peramiters returned by the event "chat_message"
- if name == acceptedUser and message == password then
- rs.setOutput("right", true)
- chatBox.say("Welcome home "..name..".")
- sleep(3)
- rs.setOutput("right", false)
- elseif name == acceptedUser and message ~= password then
- chatBox.say("That is not the password.")
- sleep(.5)
- elseif name ~=acceptedUser then
- chatBox.say("Sorry "..name.." but you do not belong here.")
- sleep(.5)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement