I am trying to add a player detector to my password door so i know who tryed to access it, but what i cant figure out is how to actually make it write to a list on another program. Can anyone help me?
Thanks!
-Will
Using ccSonsors?Hello people who read this!
I am trying to add a player detector to my password door so i know who tryed to access it, but what i cant figure out is how to actually make it write to a list on another program. Can anyone help me?
Thanks!
-Will
Hello people who read this!
I am trying to add a player detector to my password door so i know who tryed to access it, but what i cant figure out is how to actually make it write to a list on another program. Can anyone help me?
Thanks!
-Will
os.loadAPI("ocs/apis/sensor")
s=sensor.wrap(sSide)
for k,v in pairs(s.getTargets()) do print("Username: "..k.."\nCDS: "..v.Position.x..", "..v.Position.Y..", "..v.Position.Z.."\n") end
os.loadAPI("ocs/apis/sensor")
local x=yourX
local y=yourY
local z=yourZ
local sense=coroutine.wrap(function()
local s=sensor.wrap(sensorside)
while true do
local tResults=s.getTargets()
for k,v in pairs(tResults) do
if v.Position.X==x and v.Position.Y==y and v.Position.Z==z then
coroutine.yield(k)
break
end
end
sleep(0.5)
end
end)
local pass=nil
local running=false
local evts={}
while true do
local r=sense(unpack(evts))
if type(r)=="string" and running then
pass(unpack(evts))
elseif type(r)=="string" and not running then
pass=coroutine.wrap(yourpasswordfunction)
pass(r)
running=true
elseif type(r)~="string" and running
pass=nil
running=false
end
local evts={os.pullEvent()}
end
p = peripheral.wrap("<side>")
player, p1 = os.pullEvent()
print(p1)
If you read on this page:
http://www.computerc...peripherals-23/
It sais it emits the event "player" when someone right clicks it, with the player name as parameter.
so using something likep = peripheral.wrap("<side>") player, p1 = os.pullEvent() print(p1)
should print the players name, I hope this helps out