Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function drawLine(startX , startY, endX, endY, color)
- paintutils.drawLine(startX, startY, endX, endY, color)
- end
- term.setBackgroundColor(colors.white)
- paintutils.drawLine(1,1,51,1,colors.black)
- local secretInfo = {
- username = "Strite",
- password = "123456",
- }
- function PrintCustom(msg, color, color2)
- msgLen = string.len(msg)
- x1, y2 = term.getSize()
- term.setCursorPos(math.ceil(x1/2-msgLen+2), math.ceil(y2/2))
- term.setTextColor(color)
- print (msg)
- term.setTextColor(color2)
- end
- function PrintCenter(msg)
- msgLen = string.len(msg)
- screenWidth,_ = term.getSize()
- xCoords = tonumber(math.ceil((screenWidth / 2) - (msgLen / 2)))
- termY = term.getCursorPos()
- term.setCursorPos(xCoords, termY)
- print(msg)
- return xCoords
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function r()
- if term.isColor() == true then
- term.setTextColor(16384)
- else
- end
- end
- function w()
- if term.isColor() == true then
- term.setTextColor(1)
- else
- end
- end
- function g()
- if term.isColor() == true then
- term.setTextColor(8192)
- else
- end
- end
- function y()
- if term.isColor() == true then
- term.setTextColor(16)
- else
- end
- end
- function b()
- if term.isColor() == true then
- term.setTextColor(colors.black)
- else
- end
- end
- function press()
- print ("Press anything to continue.")
- os.pullEvent("key")
- sleep(1)
- end
- local v = "v.0.1"
- clear()
- function login()
- r()
- PrintCenter("Login Firewall "..v)
- print ()
- r()
- write("Username: ")
- b()
- local user = read()
- print()
- r()
- write("Password: ")
- b()
- local pass = read("*")
- if user == (secretInfo.username) and pass == (secretInfo.password) then
- print()
- PrintCustom("Correct!", 8192, 16384)
- r()
- elseif user == (secretInfo.username) and pass ~= (secretInfo.password) then
- print()
- PrintCustom("Password is wrong!", 16384, 16384)
- print()
- press()
- shell.run("password")
- elseif user ~= (secretInfo.username) and pass == (secretInfo.password) then
- print ()
- PrintCustom("Username is wrong!", 16384, 16384)
- print()
- press()
- shell.run("password")
- elseif user ~= (secretInfo.username) and pass ~= (secretInfo.password) then
- print ()
- PrintCustom("Incorrect!", 16384, 16384)
- print ()
- press()
- shell.run("password")
- else
- PrintCustom("---@Unknown error~ Restarting!@---", 16384, 16384)
- print ()
- sleep(2)
- shell.run("password")
- end
- end
- login()
Advertisement
Add Comment
Please, Sign In to add comment