Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- local mySensor = sensor.wrap("top")
- print(textutils.serialize(mySensor.getTargets()))
- while 1>0 do
- open = false
- os.sleep(0,3)
- for k,v in paires(mySensor.getTargets()) do
- if v ~= nil and v["IsPlayer"] == true then
- local pos = v["Position"]
- if pos["Z"] > -3 and pos["Z"] < 2 and pos["X"] > 2 and pos["X"] < 5 and pos["Y"] == -1 then
- open = true
- end
- end
- end
- if open == true then
- rs.setOuput("back",false)
- else
- redstone.setOuput("back",true)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement