Dojnaz

UnlockDoor

Nov 28th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. while true do
  2. redstone.setOutput("bottom", false)
  3. -- load the API
  4. os.loadAPI("ocs/apis/sensor")
  5.  
  6. -- wrap the sensor
  7. prox = sensor.wrap("right")
  8.  
  9. -- get the targets
  10. local targets = prox.getTargets()
  11.  
  12. -- loop through them
  13. for name, basicDetails in pairs(targets) do
  14.  
  15.   -- print their name
  16.   print("Found entity: "..name)
  17.   if name == "04Hannez" or name == "Hannez04" then
  18.     print("Has Access: True")
  19.   else
  20.     print("Has Access: false")
  21.   end
  22.  
  23.   -- get more details about them
  24.   local moreDetails = prox.getTargetDetails(name)
  25.  
  26.   -- print their health
  27.   print("Health: "..moreDetails.Health)
  28.  
  29.   print("------")
  30.   sleep(0.5)
  31. end
  32. end
Add Comment
Please, Sign In to add comment