Advertisement
robkatt

Remote door reciveer

Jun 8th, 2023 (edited)
972
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. local modem = peripheral.find("modem")
  2. modem.open(42131)
  3.  
  4. Door = true
  5. while true do
  6. local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
  7.  
  8. if (channel == 42131) then
  9.    
  10.     if(tostring(message) =="door") then
  11.        
  12.         if (Door == true) then
  13.             print("open")
  14.             redstone.setOutput("right", false)
  15.             Door = false
  16.          
  17.         elseif (Door == false) then
  18.             print("close")
  19.             redstone.setOutput("right", true)
  20.             Door = true
  21.         end
  22.  
  23.     end
  24. end
  25. end
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement