Advertisement
Guest User

login

a guest
Nov 13th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. --By zopther
  2. function passPrompt()
  3.  while true do
  4.   graphics.prepareScreen(colors.green, colors.black)
  5.   print("Please enter your username and password.")
  6.   write("Username:  ")
  7.   local username = string.lower(read())
  8.   write("Password:  ")
  9.   local password = string.lower(read("*"))
  10.  
  11.   if security.accValid(username, password) then
  12.    if username == "zopther" then
  13.     write("Break?: ")
  14.     sleep(0.2)
  15.     if string.lower(read()) == "y" then
  16.      break
  17.     else
  18.      shell.run("/programs/osMain")
  19.     end
  20.    else  
  21.     shell.run("/programs/osMain")
  22.    end
  23.   else
  24.    print("Password incorrect!\nPress enter to try again!")
  25.    sleep(0.5)
  26.    read()
  27.   end
  28.  end
  29. end
  30.  
  31. local function ejectDisk()
  32.  while true  do
  33.   event,side = os.pullEventRaw()
  34.   if(event == "disk" and side) then
  35.    disk.eject(side)
  36.   end
  37.  end
  38. end
  39.  
  40. local function detectCtrl()
  41.  while true do
  42.   event,keypress = os.pullEventRaw()
  43.   if(event == "key" and (keypress==29 or keypress==157)) then
  44.    os.reboot()
  45.   end
  46.  end
  47. end
  48.  
  49. parallel.waitForAny(detectCtrl, ejectDisk, passPrompt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement