This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
TheWoWClown's profile picture

[Lua]Simple Login Code

Started by TheWoWClown, 28 June 2012 - 04:23 AM
TheWoWClown #1
Posted 28 June 2012 - 06:23 AM
This is a simple login code that can be implemented onto a machine with a startup file to make you have to log in to the machine.


print (" Hello Employee. Please enter username.")
username = read()
if username == "---------" then -- Enter username here.
print (" Thank you! Please enter password.")
else
print (" Sorry, access denied, please try again.")
sleep(5)
os.shutdown() -- Shuts down system if username is incorrect.
end
password = read()
if password == "-----------" then -- Enter password here.
print ("Access granted. Have a nice day!")
else
print ("Access denied. Please try again.")
sleep(5)
os.shutdown()-- Shuts down system if password is incorrect.
end
Hope you like it. Also, I am new to Lua, so it might not be super efficient. Thanks

-TheWoWClown
Kolpa #2
Posted 28 June 2012 - 09:44 AM
This is a simple login code that can be implemented onto a machine with a startup file to make you have to log in to the machine.


print (" Hello Employee. Please enter username.")
username = read()
if username == "---------" then -- Enter username here.
print (" Thank you! Please enter password.")
else
print (" Sorry, access denied, please try again.")
sleep(5)
os.shutdown() -- Shuts down system if username is incorrect.
end
password = read()
if password == "-----------" then -- Enter password here.
print ("Access granted. Have a nice day!")
else
print ("Access denied. Please try again.")
sleep(5)
os.shutdown()-- Shuts down system if password is incorrect.
end
Hope you like it. Also, I am new to Lua, so it might not be super efficient. Thanks

-TheWoWClown

1. for the password use

password = read("*")
this will blank out the letters :P/>/>

2. put

os.pullEvent = os.pullEventRaw
at the beginning this will prevent ctrl+t
TheWoWClown #3
Posted 28 June 2012 - 04:41 PM
Thank's for the suggestion! I will get on this next time I go in the world.