Posted 05 April 2015 - 05:40 PM
I am trying to make a door that uses the seonsor from OpenPeripherals so I (TheEisbaer) and my friend (Eisbaer68) can enter our house.
This is what I got so far:
So how do I make that working:
EDIT:
I tried a bit in Ideone.com with this code:
And somehow it alway says success! though it should say failure! at least at some point.
This is what I got so far:
list={{name = "TheEisbaer"},{name = "Eisbaer68"}}
nearbyPlayers=peripheral.wrap("right").getPlayers()
for i=1,<how many players are arround> do
for j=1,2 do
if list[j]==nearbyPlayers[i][2] then
print("success!")
rs.setOutput("left",true)
sleep(2)
rs.setOuput("left",false)
else
print("failure!")
end
end
end
So how do I make that working:
- How do I detect how many players are arround?
- How do I make it working only for me and my friend?
EDIT:
I tried a bit in Ideone.com with this code:
players={{uuid = "abc",name = "TheEisbaer"},{uuid= "def",name ="Eisbaer68"},{uuid= "ghj",name = "kevin"}}
list={name ="TheEisbaer",name = "Eisbaer68"}
for i=1,3 do
for j=1,2 do
if list[j]==players[i][2] then
print("success!")
else
print("failure!")
end
print(i,j)
end
end
And somehow it alway says success! though it should say failure! at least at some point.
Edited on 05 April 2015 - 04:10 PM