Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- List of programs to check for updates
- local programs = {
- {name = "Bastion", pastebinCode = "Czt0xUgp"},
- {name = "RBastion", pastebinCode = "YLMd18xC"},
- {name = "FBastion", pastebinCode = "8pF6ds3s"},
- {name = "GPS", pastebinCode = "d8WLzv0U"},
- {name = "Update", pastebinCode = "8w6Ni2U1"},
- {name = "Greeting", pastebinCode = "REfxrLkG"},
- {name = "ArtilleryControl", pastebinCode = "BGUJrLzV"},
- {name = "startup", pastebinCode = "u2ey5fkZ"},
- {name = "todo", pastebinCode = "tfqc42mJ"},
- {name = "Teleport", pastebinCode = "CLpkvMg8"}
- -- Add more programs as needed
- }
- -- Function to delete existing program files
- local function deleteFiles()
- for _, program in ipairs(programs) do
- if fs.exists(program.name) then
- fs.delete(program.name)
- print("Deleted " .. program.name)
- end
- end
- end
- -- Function to download and update a single program
- local function updateProgram(program)
- print("Updating " .. program.name .. "...")
- local response = http.get("https://pastebin.com/raw/" .. program.pastebinCode)
- if response then
- local remoteVersion = response.readAll()
- response.close()
- local file = fs.open(program.name, "w")
- file.write(remoteVersion)
- file.close()
- print(program.name .. " updated successfully.")
- else
- print("Failed to update " .. program.name .. ". Check the Pastebin code or your internet connection.")
- end
- end
- -- Main function to delete all files and download new versions
- local function main()
- deleteFiles() -- Delete all existing files first
- for _, program in ipairs(programs) do
- updateProgram(program)
- end
- end
- -- Run main function
- main()
- shell.run("Greeting")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement