Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. local users = {["m3ntalpain"] = true,
  2. ["phaNnYpacker86"] = true,
  3. ["JellieBaby"] = true,
  4. ["kellychris200"] = true}
  5. local sensor = peripheral.wrap("right") -- where the sensor is
  6. -- How close you need to be to the sensor in order to use it.
  7. local minX = -2 local maxX = 20
  8. local minY = 0 local maxY = 20
  9. local minZ = -2 local maxZ = 20
  10. -- Initial output
  11. redstone.setOutput("back", true)
  12. while true do
  13. players = sensor.getPlayerNames()
  14. -- Don't do checks if there are no players.
  15. if #players == 0 then
  16. redstone.setOutput("back", true)
  17. sleep(0.7)
  18. else -- There are players
  19. for _, name in pairs(players) do
  20. -- If the users listed in above ( local users ) then output is true.
  21. if users[name] then
  22. info = sensor.getPlayerData(name)
  23. pos = info.position
  24.  
  25. if pos.x >= minX and pos.x <= maxX
  26. and pos.y >= minY and pos.y <= maxY
  27. and pos.z >= minZ and pos.z <= maxZ then
  28. redstone.setOutput("back", false)
  29. break
  30. end
  31. end
  32. end
  33. -- There are players around, we need to be more responsive
  34. sleep(0.5)
  35. end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement