Tutorial/Login System: Difference between revisions

m (1 revision)
 
(No difference)

Latest revision as of 01:13, 25 December 2012

This tutorial will teach you how to setup a login system for your computer.

Start by editing the startup file

-- Login System
-- Written by Brainless243
-- Posted to The Tekkit Wiki on 10/24/2012

term.clear()
term.setCursorPos(1, 1)

username = {"user1", "user2", "user3"}  -- Here you need to define all usernames avaible
password = {"pass1", "pass2", "pass3"}  -- Here you define what password each user has, remember to put user1's password in the first row and so on.

write("Username: ")
user = read()

write("Password: ")
pass = read()

for i=1, #username do
 if user == username[i] then
  if pass == password[i] then
   access = true
  end
 end
end

if access == true then
print("Logging in...")
sleep(1)
print("Welcome "..user)
else
print("Incorrect username and password combination")
sleep(2)
os.reboot()
end



And thats it. If you want to make the program un-terminateable then put this as the first line in the program

os.pullEvent = os.pullEventRaw







Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Need wiki hosting?

Do you need a wiki for your Minecraft mod/gaming wiki? We'll host it for free! Contact us.

Other wikis

Indie-game wikis
Powered by Indie Wikis