Posted 24 September 2012 - 06:32 AM
I have made this simple program for locking your computer with a password. This will make it so only you (and whom ever you give the password to) can access the files on it. Now enough talking here is the code! (For more easy reading http://pastebin.com/Hcj7upAe)
You will need to rename it startup and if you want, make a VERY simple program called "lock" that looks like this.
This will allow you to lock your computer easily!
Hope you like! If you need any help or have some pointers let me know!
EDIT: I have taken Mtdj2's advise and moved the anti-terminate code outside of the loop.
EDIT: Compressed to coding down a bit to take up less space.
local password = "<password>" -- Change this to what you want your password to be.
local oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
while true do
term.clear()
term.setCursorPos(1,1)
write("Password:")
local input = read("*")
if input == password then
print("Welcome!")
sleep(2)
term.clear()
term.setCursorPos(1,1)
break
else
print("Password incorect!")
sleep(2)
term.clear()
term.setCursorPos(1,1)
print("Goodbye!")
sleep(2)
os.shutdown()
end
end
os.pullEvent = oldPull
You will need to rename it startup and if you want, make a VERY simple program called "lock" that looks like this.
shell.run("startup")
This will allow you to lock your computer easily!
Hope you like! If you need any help or have some pointers let me know!
EDIT: I have taken Mtdj2's advise and moved the anti-terminate code outside of the loop.
EDIT: Compressed to coding down a bit to take up less space.