Posted 29 March 2015 - 11:00 AM
Hello,
So i'm trying to make a door with a blacklist, whitelist and unknow list but i've got some problems
1. When there is no player nearby it says;"Attempt to index?".but when there is a player when the program starts it does work and reply as wanted
2. i would like some help with the black and whitelist part i've looked around on the internet for days and i still don't get how its suppost to work
3. if you find a thing that can be done beter tell me i'm open for it.
here is the code:
jarifle is me and prince_stark is someone i want on the whitelist.
if someone could help me i would be so happy.
Thank you.
PS.sorry for spelling and grammar i'm form belgium.
So i'm trying to make a door with a blacklist, whitelist and unknow list but i've got some problems
1. When there is no player nearby it says;"Attempt to index?".but when there is a player when the program starts it does work and reply as wanted
2. i would like some help with the black and whitelist part i've looked around on the internet for days and i still don't get how its suppost to work
3. if you find a thing that can be done beter tell me i'm open for it.
here is the code:
local s = peripheral.wrap("left")
local speaker = peripheral.wrap("right")
function getInfo()
info = s.getPlayers()
return info
end
function getUsername()
getInfo()
info = s.getPlayers()
username = info[1].name
return username
end
while true do
getInfo()
getUsername()
if username == "jarifle" then
speaker.speak("Welcome home master! How are you today?", 15, "en")
sleep(2.8)
speaker.speak("Let me just open the base for you.", 15, "en")
rs.setOutput("back", true )
sleep(10)
shell.run("reboot")
elseif username == "Prince_Stark" then
speaker.speak("Welcome guest! Acces to the base has been granted", 15, "en")
sleep(3)
speaker.speak("Opening the base.", 15, "en")
rs.setOutput("back", true )
sleep(10)
m.clear()
shell.run("reboot")
end
sleep(1)
end
jarifle is me and prince_stark is someone i want on the whitelist.
if someone could help me i would be so happy.
Thank you.
PS.sorry for spelling and grammar i'm form belgium.
Edited on 29 March 2015 - 10:13 AM