LUModder

Password Lock - ComputerCraft

Sep 13th, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. --Made by LUModder
  2. local function clear()
  3.   term.clear()
  4.   term.setCursorPos(1,1)
  5. end
  6. os.pullEvent = os.pullEventRaw
  7. local tries = 3 --Optional change
  8. while tries > 0 do
  9.   clear()
  10.   print("A password is required to access this computer.")
  11.   write("Password: ")
  12.   local input = read("*")
  13.   if input == "YourPasswordHere" then --Change this
  14.         print("Password Accepted. Access Granted.")
  15.         sleep(1)
  16.         clear()
  17.         shell.run("shell")
  18.   else
  19.         print("Password Rejected. Access Denied.")
  20.         tries = tries - 1
  21.         print(tries.." tries remaining.")
  22.         sleep(1)
  23.   end
  24. end
  25. local sec = 10 --5 - 10 seconds recomended
  26. while sec ~= 0 do
  27.   clear()
  28.   print("Please try again in "..sec.." seconds.")
  29.   sec = sec - 1
  30.   sleep(1)
  31. end
  32. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment