Posted 29 June 2016 - 10:50 AM
Hi.
This is my code for a sensor opening door lock system and it's working perfect! BUT i was wondering how i could count the number of entitys/players inside the radius of the sensor and stop the script from running and tell them "s.speak("Only 1 person at a time")"?
sub.question, is it possible to set the radius for the openCCsensor sensor?
This is my code for a sensor opening door lock system and it's working perfect! BUT i was wondering how i could count the number of entitys/players inside the radius of the sensor and stop the script from running and tell them "s.speak("Only 1 person at a time")"?
sub.question, is it possible to set the radius for the openCCsensor sensor?
os.loadAPI("sensor")
prox = sensor.wrap("left")
s = peripheral.wrap("right")
while true do
local targets = prox.getTargets()
local moreDetails = prox.getTargetDetails(name)
s.speak("Please step onto marked area and stand still")
sleep(5)
for name, basicDetails in pairs(targets) do
s.speak("Scanning Entity")
sleep(3)
if name == "KrisRevi" then
s.speak("Access Granted, welcome KrisRevi")
sleep(10)
elseif name == "UNLEASHED91" then
s.speak("Access Granted, welcome Unleashed")
sleep(10)
end
end
end