Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Usage:
- -- detector <x1> <y1> <z1> <x2> <y2> <z2>
- local args = { ... }
- if #args ~= 6 then
- print("Usage: detector <x1> <y1> <z1> <x2> <y2> <z2>")
- return
- end
- local detector = peripheral.find("playerDetector")
- assert(detector, "Player Detector not found")
- local posOne = {
- x = tonumber(args[1]),
- y = tonumber(args[2]),
- z = tonumber(args[3])
- }
- local posTwo = {
- x = tonumber(args[4]),
- y = tonumber(args[5]),
- z = tonumber(args[6])
- }
- while true do
- local players = detector.getPlayersInCoords(posOne, posTwo)
- if #players > 0 then
- print("Player Detected!")
- redstone.setOutput("back", true)
- else
- redstone.setOutput("back", false)
- end
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment