Advertisement
FiireWiinter

CCRBloadingscreen

Oct 9th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.00 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. local function pause(key)
  3.   print('Press X to continue.')
  4.   while true do
  5.             local sEvent, sParam=os.pullEvent('char')
  6.             if string.lower(sParam)==key then
  7.             term.clear()
  8.    break
  9.             end
  10.   end
  11. end
  12. local progressbar = {"----------","o---------","oo--------","ooo-------","oooo------","ooooo-----","oooooo----","ooooooo---","oooooooo--","ooooooooo-","oooooooooo"} -- added the possible strings into a table
  13. term.clear()
  14. sleep(1)
  15. term.setCursorPos(15,2)
  16. print("CraftOS is starting...")
  17. for i=1,#progressbar do
  18. term.setCursorPos(20,4)
  19. print(progressbar[i])
  20. sleep(0.5)
  21. end
  22. sleep(1.0)
  23. term.clear()
  24. term.setCursorPos(21,2)
  25. print("Welcome!")
  26. sleep(2.5)
  27. local intcount=0
  28. term.clear()
  29. term.setCursorPos(1,1)
  30. print("Login")
  31. while true do
  32.   write("Username: ")
  33.   userNameInput = read()
  34.   if string.lower(userNameInput) == "admin" then
  35.    sleep(1)
  36.    break
  37.   else
  38.   sleep(1)
  39.    print("Username not found.")
  40.    intcount=intcount+1
  41.    sleep(1)
  42.    for i=3,2,-1 do
  43.             term.setCursorPos(1,i)
  44.             term.clearLine()
  45.    end
  46.   end
  47.   if intcount==3 then
  48.    print('You have entered an invalid username too many times.')
  49.    sleep(5)
  50.    os.shutdown()
  51.   end
  52. end
  53. local intcount=0
  54. while true do
  55.   write("Password: ")
  56.   passwordInput = read("*")
  57.   print("Verifying login...")
  58.   sleep(2.5)
  59.   if passwordInput == "banana" then
  60.   print("Loading your settings...")
  61.   sleep(1.5)
  62.   print("Logging in...")
  63.   sleep(3.5)
  64.   term.clear()
  65.   term.setCursorPos(1,1)
  66.    print("Welcome to CraftOS!Say turnoff for shutting down the computer!")
  67.    pause('x')
  68.    term.setCursorPos(1,2)
  69.    term.clearLine()
  70.    break
  71.   else
  72.    print("The password you have entered is incorrect.")
  73.    intcount=intcount+1
  74.    sleep(1)
  75.    for i=6,3,-1 do
  76.             term.setCursorPos(1,i)
  77.             term.clearLine()
  78.    end
  79.   end
  80.   if intcount==3 then
  81.    print('You have entered an incorrect password too many times.')
  82.    sleep(5)
  83.    os.shutdown()
  84.   end
  85. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement