Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function loadUser()
- local loadTable = {}
- local file = fs.open(".pass", "r")
- if file then
- readLine = file.readLine()
- while readLine do
- local lineTable = {}
- lineTable.user, lineTable.pass = string.match(readLine, "(%w+),(%w+)")
- if lineTable.type then
- table.insert(loadTable, lineTable)
- end
- readLine = file.readLine()
- end
- file.close()
- end
- return loadTable
- end
- --user check
- local username,password = loadUser()
- if usernamd == nil and password == nil then
- term.clear()
- term.setCursorPos(1,1)
- write("Please choose your Username: ")
- local user = read()
- term.clear()
- term.setCursorPos(1,1)
- write("Please choose your Password: ")
- local pass = read("*")
- local file = fs.open(".password","w")
- file.write(user..","..pass)
- file.close()
- else
- while true do
- term.clear()
- termsetCursorPos(1,1)
- write("Please enter Username: ")
- local user = read()
- term.clear()
- term.setCursorPos(1,1)
- write("Please enter Password: ")
- local pass = read("*")
- if user == username and pass = password then
- redstone.setOutput("left",true)
- redstone.setOutput("right",true)
- sleep(3)
- redstone.setOutput("right",false)
- redstone.setOutput("left",false)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment