Posted 17 May 2016 - 07:13 AM
Im still a big noob to this stuff and I need help with a program to detect other players. Any help is great. Please and thank you! Sorry my codes a mess.
What im trying to do
Detect if a player is me or my friend or no one and keep redflag set to false.
Set redflag to true when anyone else enters the area and put off a redstone signal to the left.
redstone torch up front stops program
What it does do
Detects all players and sets redflag to true then gives off a redstone signal to the left
a redstone signal input up front will stop the program
What im trying to do
Detect if a player is me or my friend or no one and keep redflag set to false.
Set redflag to true when anyone else enters the area and put off a redstone signal to the left.
redstone torch up front stops program
What it does do
Detects all players and sets redflag to true then gives off a redstone signal to the left
a redstone signal input up front will stop the program
os.loadAPI("ocs/apis/sensor")
local tzs = sensor.wrap("top")
local redflag = false
local power = false
--print(textutils.serialize(tzs.gettargets())
while 1 > 0 do
--front killer
if power == true then
redstone.setAnalogOutput("left",0)
return
end
if redstone.getAnalogInput("front") == 15 then
power = true
open = false
end
-- front killer end
for k,v in pairs(tzs.getTargets()) do
if v ~= nil and v["IsPlayer"] == true then
redflag = true
else
redflag = false
end end
os.sleep(0.5)
if redflag == true then
redstone.setAnalogOutput("left",15)
else
redstone.setAnalogOutput("left",0)
end
end
Edited on 17 May 2016 - 05:15 AM