Advertisement
tima_gt

tde-lock 3.4-alpha

Aug 19th, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. --Checks for password file------------
  2. if fs.exists(".tde-password") then  --
  3. file = fs.open(".tde-password", 'r')--
  4. password = file.readLine()          --
  5. file.close()                        --
  6. else                                --
  7. password = false                    --
  8. end                                 --
  9. --------------------------------------
  10. --        Password Checking:
  11. local function unlock()
  12. if password then
  13.   term.setBackgroundColor(colors.blue)
  14.   term.setTextColor(colors.yellow)
  15.   write("Password for unlock: ")
  16.   term.setBackgroundColor(colors.blue)
  17.   term.setTextColor(colors.yellow)
  18.   password_check = read("*")
  19.   if password_check == password then
  20.     return true
  21.   end
  22. else
  23.   return true
  24.  end
  25. end
  26. --     lock
  27. while true do
  28.   term.setBackgroundColor(colors.blue)
  29.   term.setTextColor(colors.white)
  30.   term.clear()
  31.   term.setCursorPos(18, 1)
  32.   write("Computer Locked")
  33.   term.setCursorPos(8, 4)
  34.   local event, button, X, Y = os.pullEventRaw()
  35.   checking = unlock()
  36.   if checking then
  37.     term.setBackgroundColor(colors.black)
  38.     term.setTextColor(colors.white)
  39.     term.clear()
  40.     term.setCursorPos(1, 1)
  41.     break
  42.   end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement