LoveGmod1

red-fm-server-emit.lua

Jun 23rd, 2023
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. peripheral.find("modem", rednet.open)
  2.  
  3. local protocol = "red-fm"
  4.  
  5. print(protocol.." > Synchronisé")
  6.  
  7. local function getAudioContent(path)
  8.     print("Chargement et envoi du fichier "..path)
  9.     local file = fs.open(path, "rb")
  10.     local audioContent = file.readAll()
  11.     file.close()
  12.     return audioContent
  13. end
  14.  
  15. print("Transmission aux postes d'écoutes")
  16.  
  17. while true do
  18.     rednet.broadcast(getAudioContent("red-fm-jingle.dfpwm"), protocol)
  19.     sleep(11)
  20.     rednet.broadcast(getAudioContent("advert"..math.random(1, 1)..".dfpwm"), protocol)
  21.     sleep(11)
  22.     rednet.broadcast(getAudioContent("red-fm-jingle.dfpwm"), protocol)
  23.     sleep(11)
  24.     rednet.broadcast(getAudioContent("music"..math.random(1, 1)..".dfpwm"), protocol)
  25.     sleep(150)
  26. end
Add Comment
Please, Sign In to add comment