I tried removing the sleep command to keep the redstone constant but it doesnt work. Also im trying to figuire out a better way of whitelisting people, instead of having to whitelist each player with a "long" code i want everyone on a seperate program and just write theyre name and it whitelists/blacklists them. im fairly new to this.
here is the code:
p = peripheral.wrap("right")
m = peripheral.wrap("top")
local whiteList = {}
local blackList = {}
m.clear()
--whiteList["Player1"] = true
whiteList["KingMinecrafter"] = true
whiteList["Falmaze"] = true
whiteList["hayboy2001"] = true
whiteList["ryguy6011"] = true
whiteList["cody1904"] = true
whiteList["SkeliWar"] = true
blackList[""] = true
function centerText(text)
m.setTextScale(1,9)
x,y = m.getSize()
x1,y1 = m.getCursorPos()
m.setCursorPos((math.floor(x/2) - (math.floor(#text/2))), y1)
m.write(text)
end
function white(playerName)
y2 = 3
m.setTextColor(1)
m.setCursorPos(1, 3)
centerText(" Welcome back")
m.setCursorPos(1, 5)
m.setTextColor(32)
centerText(" "..playerName.." ")
m.setCursorPos(1, 7)
m.setTextColor(1)
centerText("Door is now open")
rs.setBundledOutput("back", colors.lime)
sleep(2)
end
function black(playerName)
m.clear()
y2 = 3
m.setCursorPos(1, y2)
centerText("Blacklisted player: "..playerName.." Recognized, lockdown initiated")
rs.setBundledOutput("back", 0)
rs.setBundledOutput("back", colors.red)
end
function nobody(playerName)
m.clear()
y2 = 3
m.setCursorPos(1, y2)
centerText("Unrecognised player: "..playerName.." Please leave")
end
function reset()
rs.setBundledOutput("back", 0)
end
while true do
sleep(1)
players = p.getPlayerNames()
for num,name in pairs(players) do
if whiteList[name] then
print("Whitelisted Players: "..name.."")
white(name)
elseif blackList[name] then
print("Blacklisted Players: "..name.."")
black(name)
else
print("System does not recognize player: "..name.."")
nobody(name)
rs.setBundledOutput("back",0)
end
rs.setBundledOutput("back", 0)
end
end