Advertisement
Frekvens1

Frekvens1's CC Door Lock Setup Part1

Nov 20th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.87 KB | None | 0 0
  1. -- This setup is made by Frekvens1
  2. -- Do not claim this as your own,
  3. -- but you can feel free to use it.
  4.  
  5. -- pastebin get vt61373P disk/startup
  6. -- pastebin get rHNtR9W3 disk/Protection
  7.  
  8. -- Select The Password you want to use
  9.  
  10.    local selectedPass = ""
  11.  
  12. function selectCurrentPassword()
  13.    term.clear()
  14.    term.setCursorPos(1,1)
  15.    MyScreen()
  16.    write("Please type the password you want to use: ")
  17.    selectedPass = read()
  18.    term.clear()
  19.    term.setCursorPos(1,1)
  20.    file = io.open("Password", "w")
  21.    file:write(selectedPass)
  22.    file:close()
  23.    Install()
  24. end
  25.  
  26. -- Installs the software
  27. function Install()
  28.    MyScreen()
  29.    fs.delete("startup")
  30.    fs.copy("disk/Protection", "startup")
  31.    print("Selected Password: ",selectedPass)
  32.    shell.setAllowDiskBoot(false)
  33.    print("Setup is starting...")
  34.    print("")
  35.    print("Installation is done!")
  36.    print("Reboots in")
  37.    print("3")
  38.    sleep(1)
  39.    print("2")
  40.    sleep(1)
  41.    print("1")
  42.    sleep(1)
  43.    print("Rebooting...")
  44.    sleep(1)
  45.    os.reboot()
  46. end
  47.  
  48. -- Startup screen
  49. function MyScreen()
  50.    print("------------------------------------------------")    
  51.    print("- Starting Frekvens1's Password Protected Door -")
  52.    print("------------------------------------------------")
  53.    print("-                Version: 1.0.0                -")
  54.    print("------------------------------------------------")
  55. end
  56.  
  57.  
  58. function startupSoftware()
  59.    MyScreen()
  60.    IsInstalled()
  61. end
  62.  
  63. -- ChecksIfInstalled
  64. function IsInstalled()
  65.    if fs.exists("Password") then
  66.       print("Software Already Installed! Do you want to change the password? Y/N")
  67.       local Answer = ""
  68.       Answer = read()
  69.       if Answer == "Y" then
  70.          selectCurrentPassword()
  71.       else
  72.          shell.run("startup")
  73.       end
  74.    else
  75.       selectCurrentPassword()
  76.    end
  77. end
  78.  
  79. term.clear()
  80. term.setCursorPos(1,1)
  81. startupSoftware()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement