I have no idea what to do!?
Can anyone help me?
os.loadAPI("ocs/apis/sensor")
-- the location of the redstone lamp relative to the sensor
local offset = {
X = 1,
Y = 1,
Z = 0
}
-- how close a player has to be to activate the lamp
local radius = 5
-- find the distance from the player position to the offset
function distance(pos)
local xd = pos.X - offset.X
local yd = pos.Y - offset.Y
local zd = pos.Z - offset.Z
return math.sqrt(xd*xd + yd*yd + zd*zd)
end
local proximity = sensor.wrap("left")
while true do
local signal = false
local targets = proximity.getTargets()
for k, v in pairs(targets) do
if distance(v.Position) < radius then
signal = true
end
end
rs.setOutput("top", signal)
end












