Advertisement
PhyscoKillerMonkey

Proximity Door

Apr 8th, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3. os.loadAPI("ocs/apis/sensor")
  4. local prox = sensor.wrap("top")
  5.  
  6. function checkPlayer()
  7.     target = prox.getTargets()
  8.     for k,v in pairs(target) do
  9.         if k == "BenneyBoy444" then
  10.             details = prox.getTargetDetails(k)
  11.             if details.Position.X < 3 and details.Position.X > 0 and details.Position.Z > -1.5 and details.Position.Z < 2.5 then
  12.                 return true
  13.             end
  14.         end
  15.     end
  16. end
  17.  
  18. while true do
  19.     if checkPlayer() then
  20.         rs.setOutput("left", true)
  21.     else
  22.         rs.setOutput("left", false)
  23.     end
  24.     sleep(0.2)
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement