Posted 11 April 2013 - 05:31 PM
Lockout API
Lockout API. An API that makes it easier to make a security program.
Lockout API is a very simple API to use. Basicly, run the functions and they will do all of it for you. The only thing you need to do is the Interface.
Install:
Spoiler
1. Copy the API from the spoiler.2. paste it into a text editor
3. Save it to %appdata%/.minecraft/mods/computercraft/lua/rom/apis
4. Launch Minecraft
Usage:
Spoiler
lockout.usernameFile("username")
lockout.passwordFile("password")
lockout.denyTerminate()
lockout.promptUser()
lockout.promptPass()
lockout.check()
if lockout.check() == true then
print ("Login successful!")
else
print ("Username or password incorrect")
sleep(1)
shell.run("clear")
shell.run("startup")
end
Also make sure to make a file for username and password!
Functions:
Spoiler
version: Returns lockout versionusernameFile("usernamefile"): Opens the username file to be handled.
passwordFile("passwordfile"): Opens the password file to be handled.
denyTerminate(): Disables Ctrl + t.
promptUser(): prompts with "Enter Username: "
promptPass(): prompts with "Enter Password: "
check(): Returns true if user == username and pass == password
API:
Spoiler
function version()
return "0.0.1"
end
function usernameFile(file)
usernameFile = fs.open(file, "r")
username = usernameFile.readLine()
end
function passwordFile(file)
passwordFile = fs.open(file, "r")
password = passwordFile.readLine()
end
function denyTerminate()
os.pullEvent = os.pullEventRaw
end
function promptUser()
write("Enter Username: ")
user = read()
end
function promptPass()
write("Enter Password: ")
pass = read("*")
end
function check()
if user == username and pass == password then
return true
else
return false
end
end