Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- This is a program I wrote to open/close a door depending on whether or not
- a player is near. It isn't that great. I just works. Note: Uses the
- openperipheral sensor block
- You can give it arguments as follows:
- <progname> <sideofsensor> <sideofredstone>
- if you don't give it anything it just uses right and left respectively.
- ]]
- args = {...}
- local side = {"right","left"}
- if args[1] then side[1] = args[1] end
- if args[2] then side[2] = args[2] end
- m = peripheral.wrap(side[1])
- while true do
- players = m.getPlayerNames()
- if players[1] then
- rs.setOutput(side[2],true)
- else
- rs.setOutput(side[2],false)
- end
- for a,b in pairs(players) do
- term.write(math.floor(a))
- term.write(":")
- print(b)
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement