Advertisement
Spirit13300

dertecttt

Apr 21st, 2017
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2. local mySensor = sensor.wrap("top")
  3. print(textutils.serialize(mySensor.getTargets()))
  4.  
  5. while 1>0 do
  6.     open = false
  7. os.sleep(0,3)
  8. for k,v in paires(mySensor.getTargets()) do
  9. if v ~= nil and v["IsPlayer"] == true then
  10. local pos = v["Position"]
  11. if pos["Z"] > -3 and pos["Z"] < 2 and pos["X"] > 2 and pos["X"] < 5 and pos["Y"] == -1   then
  12. open = true
  13. end
  14. end
  15. end
  16. if open == true then
  17.     rs.setOuput("back",false)
  18. else
  19. redstone.setOuput("back",true)
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement