Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local side = "back"
- local opentime = 5
- os.pullEvent = os.pullEventRaw -- Prevents CTRL+T shortcut
- term.clear() -- Clears the screen
- term.setCursorPos(1, 1) -- The places the print position to the top of screen
- username = {"Tody", "Detona", "Poteto", "zirkin", "Francisco"} -- Here you need to define all usernames avaible
- password = {"ABCD", "EUSOMITO", "LOL", "z0k2n7", "2203"} -- Here you define what password each user has, remember to put user1's password in the first row and so on.
- monitor = peripheral.wrap("right")
- monitor.setTextScale(1)
- monitor.setBackgroundColor(colors.blue)
- monitor.clear()
- monitor.setCursorPos(1, 1)
- monitor.setTextColor(colors.green)
- monitor.write("Login: ")
- user = read()
- monitor.setCursorPos(1, 2)
- monitor.setTextColor(colors.green)
- monitor.write("Senha: ")
- pass = read('*') -- This prevents people from reading the password as you put it in
- for i=1, #username do -- Starts a loop
- if user == username[i] and pass == password[i] then
- access = true
- end
- end
- if access == true then
- monitor.setCursorPos(1, 3)
- monitor.setTextColor(colors.red)
- monitor.write("Logando...")
- sleep(1)
- monitor.setCursorPos(1, 4)
- monitor.setTextColor(colors.red)
- monitor.write("Bem vindo a ilha "..user)
- rs.setOutput(side,true)
- sleep(opentime)
- rs.setOutput(side,false)
- os.reboot()
- else
- monitor.setCursorPos(1,3)
- monitor.setTextColor(colors.red)
- monitor.write("Username e senha incorreta")
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement