Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ADMIN_PASS = "Mimidou00.."
- ADMIN_NAME = "BastouP"
- OWNER_PASS = {["TeKo"] = "1596"}
- USER_PASS = {["Skylyx"] = "mercredi", ["xavcdb"] = "choucroute"}
- function clr(arg)
- term.clear()
- if arg then
- term.setCursorPos(1,1)
- end
- end
- function testPassword(test)
- for k,v in pairs(USER_PASS) do
- if test == v then
- return k
- end
- end
- return nil
- end
- function testOwner(test)
- for k,v in pairs(OWNER_PASS) do
- if test == v then
- return k
- end
- end
- return nil
- end
- function password(adm, txt)
- clr(true)
- if adm then
- type = "owner"
- else
- type = "user"
- end
- print("+-------------------------------------------------+")
- print("|["..txt.."] Enter "..type.." password please.")
- print("|=>")
- print("+-------------------------------------------------+")
- print("|>")
- print("+-------------------------------------------------+")
- term.setCursorPos(51,2)
- print("|")
- term.setCursorPos(51,3)
- print("|")
- term.setCursorPos(51,5)
- print("|")
- term.setCursorPos(4,3)
- pass = read("*")
- user = testPassword(pass)
- owner = testOwner(pass)
- len = string.len(pass)
- if adm then
- if pass == ADMIN_PASS then
- access = 3
- phrase = "Welcome "..ADMIN_NAME.."!"
- term.setTextColor(colors.cyan)
- elseif owner ~= nil then
- access = 2
- term.setTextColor(colors.orange)
- phrase = "Welcome "..owner.."!"
- else
- phrase = "Access denied."
- access = 0
- term.setTextColor(colors.red)
- end
- else
- if pass == ADMIN_PASS then
- access = 3
- phrase = "Welcome "..ADMIN_NAME.."!"
- term.setTextColor(colors.cyan)
- elseif owner ~= nil then
- access = 2
- phrase = "Welcome "..owner.."!"
- term.setTextColor(colors.orange)
- elseif user ~= nil then
- access = 1
- phrase = "Welcome "..user.."!"
- term.setTextColor(colors.lime)
- else
- access = 0
- phrase = "Access denied."
- term.setTextColor(colors.red)
- end
- end
- if len > 0 then
- term.setCursorPos(4,3)
- for i=1,len,1 do
- write("*")
- end
- end
- term.setCursorPos(4,5)
- write(phrase)
- term.setTextColor(colors.white)
- return access
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement