Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local version =
- 3
- -- Program pro >vysilani< zprav pres modem
- -- Pri zmene programu je treba na radku "2" zmenit verzi, aby se program automaticky aktualizoval
- -- "local code" je treba zmenit dle potreby
- -- Server:
- -- pastebin get NNbbTX6n startup
- -- Client:
- -- pastebin get yKvCXrCg startup
- local code = "NNbbTX6n"
- --check version
- term.clear()
- term.setCursorPos(1,1)
- print("Program loading...")
- print("Current version: "..version)
- local updateSite= http.get("http://pastebin.com/raw.php?i="..code)
- updateSite.readLine()
- local newVersion = updateSite.readLine()
- if tonumber(newVersion) > version then
- print("Update required. Updating now...")
- local updateSite = http.get("http://pastebin.com/raw.php?i="..code)
- local siteFile = updateSite.readAll()
- local writeFile = fs.open(shell.getRunningProgram(),"w")
- writeFile.write(siteFile)
- writeFile.close()
- print("The program will now restart your computer.")
- sleep(1)
- os.reboot()
- end
- function start()
- while true do
- print ("Program bezi...")
- local modem = peripheral.wrap("right") -- Wraps the modem on the right side.
- print("Zadej prikaz: ")
- local input = read()
- print("Odesilam prikaz:")
- print(input)
- print("..pres modem...")
- rednet.broadcast(input)
- print("Prikaz odeslan...")
- modem.transmit(16384, 1, input)
- --peripheral.call("right", "transmit", 16384, 1, "This will also work!")
- rednet.open("right")
- print ("Oteviram modem right.")
- end
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement