Advertisement
Guest User

passwordDoor

a guest
Aug 24th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. chatBox = peripheral.wrap("left") --defines the side for the chatbox
  2. rs.setOutput("right", false) --sets the redstone signal on the right side to be off, place a door on this side
  3. acceptedUser = "Sandrino1"
  4. password = "password"
  5. chatBox.setDistance(4)
  6. while true do
  7. local event, side, name, message = os.pullEvent("chat_message") -- defines the names of all the peramiters returned by the event "chat_message"
  8. if name == acceptedUser and message == password then
  9. rs.setOutput("right", true)
  10. chatBox.say("Welcome home "..name..".")
  11. sleep(3)
  12. rs.setOutput("right", false)
  13. elseif name == acceptedUser and message ~= password then
  14. chatBox.say("That is not the password.")
  15. sleep(.5)
  16. elseif name ~=acceptedUser then
  17. chatBox.say("Sorry "..name.." but you do not belong here.")
  18. sleep(.5)
  19. end
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement