Posted 17 October 2012 - 07:06 PM
Hello, im trying to add to program a limit of tries, so that if you input the password wrong 3 times it locks the computer for 30 sec. or anything you can do to help me, either way, must have a limit of 3 tries before it locks for 30sec or shutsdown. either way, plzzz help.
local sPath = ":/rom/programs"
term.clear()
term.setCursorPos(1,1)
print("==========================================================")
term.setCursorPos(1,2)
textutils.slowPrint(" Welcome to R.S. Incorporated ")
term.setCursorPos(1,3)
print("=========================================================")
term.setCursorPos(1,5)
print("Users: ")
term.setCursorPos(1,6)
textutils.slowPrint("- predatorxil - nexoigi")
term.setCursorPos(1,7)
textutils.slowPrint("- axel1298 - ztrevetty88")
term.setCursorPos(1,8)
textutils.slowPrint("- coolwater97")
term.setCursorPos(1,9)
print("==========================================================")
term.setCursorPos(1,4)
textutils.slowPrint("Os Version 3.1")
term.setCursorPos(1,10)
textutils.slowPrint("Message: Enter UserName")
term.setCursorPos(1,11)
os.pullEvent = os.pullEventRaw
local tUsers = {}
tUsers["predatorxil"] = "13034"
tUsers["nexoigi"] = "999"
tUsers["coolwater97"] = "sarah1157"
tUsers["axel1298"] = "999"
while true do
write("Username: ")
name = read()
if tUsers[name] then
term.setCursorPos(10,10)
textutils.slowPrint("Enter Password")
term.setCursorPos(1,12)
write("Password: ")
pass = read("*")
if tUsers[name] == pass then
term.setCursorPos(10,10)
textutils.slowPrint("Access Approved")
sleep(.5)
rs.setOutput("back", true)
sleep(5)
rs.setOutput("back", false)
sleep(1)
os.reboot()
else
end
end
term.setCursorPos(10,10)
textutils.slowPrint("Access Denied ")
sleep(2)
os.reboot()
end