This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Alu's profile picture

OpenCCSensors Player Name Output

Started by Alu, 02 June 2013 - 04:38 PM
Alu #1
Posted 02 June 2013 - 06:38 PM
"OpenCCSensors Player Name Output : i need the name of a player when he comes near to my computer (using occs sensors)
Lyqyd #2
Posted 03 June 2013 - 12:53 PM
Split into new topic.

I believe you want the Username key from the detailed info of the target. Use ocs/programs/sensorview to confirm.
tvc #3
Posted 05 June 2013 - 11:07 PM
try this

os.loadAPI("ocs/apis/sensor")
prox = sensor.wrap("right") – change to the correct side


while true do
t = prox.getTargets()
for name, details in pairs(t)
if details.Name == "Player" then
local x = prox.getTargetDetails(name)
print(x.Username)
end
end