oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
local input = ""
local side = "bottom"
local pass = {
pass1 = "opendoor1", pass1color = colors.red,
pass2 = "opendoor2", pass2color = colors.green,
pass3 = "opendoor3", pass3color = colors.blue,
pass4 = "opendoor4", pass4color = colors.yellow,
pass5 = "opendoor5", pass5color = colors.lime,
pass6 = "opendoor6", pass6color = colors.white,
pass7 = "opendoor7", pass7color = colors.pink,
pass8 = "opendoor8", pass8color = colors.black,
pass9 = "opendoor9", pass9color = colors.brown,
admin = "passadmin"
}
function checkPass(password)
for id,value in pairs(pass) do
if password == value then
if id ~= "admin" then
return true, id
else
return "admin"
end
end
end
return false
end
while true do
term.clear()
term.setCursorPos(1,1)
print("Welcome to Evolution-Lock v.1.0")
print("Please Enter a Door password")
print("=[roomname]=[roomname]=[roomname]=")--Change [roomname] to the name of your room's
print("=[roomname]=[roomname]=[roomname]=")--Change [roomname] to the name of your room's
print("=[roomname]=[roomname]=[roomname]=")--Change [roomname] to the name of your room's
write("Password: ")
input, passID = checkPass(read("*"))
if input == true then
rs.setBundledOutput(side, pass[passID.."color"])
print()
local x,y = term.getCursorPos()
for time = 7, 1, -1 do
term.setCursorPos(x,y)
term.clearLine()
write("Closing door in "..time.." seconds!")
sleep(1)
end
rs.setBundledOutput(side, 0)
elseif input == "admin" then
term.clear()
term.setCursorPos(1,1)
print("Password correct!")
print("Computer unlocking...")
print("Please type 'reboot' or 'shutdown' before leaving")
break
else
term.clear()
term.setCursorPos(1,1)
print("Incorrect password!")
sleep(2)
end
end
os.pullEvent = oldPull
Comments