Posted 06 November 2013 - 10:32 AM
I based my coding off a previous post on these forums, and I thought I'd cracked the code but turns out I hadn't and ended locking myself out of my PC.
This worked with WizardHD user, but whenever DrSandwich was typed in as the username it restarted the whole thing and took you to where you type in your username.
This is probably a really stupid mistake or something, I've tried coding things before but never been bothered to read the books and this is fun and easy and in a game so I started on this, so in essence this is my first day of coding.
All help will be appreciated! Thanks.
oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
while true do
term.clear()
term.setCursorPos(1,1)
print("Borta Computer Security 1.1")
write("Username: ")
if read() == "WizardHD" then
write("Password: ")
if read("*") == "pass1" then
print("Welcome back, WizardHD!")
sleep(2)
term.clear()
term.setCursorPos(1,1)
break
elseif read() == "DrSandwich" then
write("Password: ")
if read("*") == "pass2" then
print("Welcome back, DrSandwich!")
sleep(2)
term.clear()
term.setCursorPos(1,1)
break
else
print ("Access Denied.")
sleep(1)
end
end
os.pullEvent = oldPull
This worked with WizardHD user, but whenever DrSandwich was typed in as the username it restarted the whole thing and took you to where you type in your username.
This is probably a really stupid mistake or something, I've tried coding things before but never been bothered to read the books and this is fun and easy and in a game so I started on this, so in essence this is my first day of coding.
All help will be appreciated! Thanks.