diff --git a/scripts/client/radio.js b/scripts/client/radio.js index d9b2c096..33ab85ad 100644 --- a/scripts/client/radio.js +++ b/scripts/client/radio.js @@ -8,13 +8,6 @@ // =========================================================================== function playStreamingRadio(url, loop, volume, element = false) { - if(url == "") { - if(streamingRadio != null) { - streamingRadio.stop(); - } - return true; - } - if(streamingRadio != null) { streamingRadio.stop(); } @@ -42,4 +35,15 @@ function setStreamingRadioVolume(volume) { } } +// =========================================================================== + +function playAudioFile(audioName, loop, volume) { + let resource = findResourceByName("connectedrp-extra"); + if(resource == null) { + return false; + } + + resource.exports.playCustomAudio(audioName, volume/100); +} + // =========================================================================== \ No newline at end of file diff --git a/scripts/server/developer.js b/scripts/server/developer.js index 20c72031..685e0ac1 100644 --- a/scripts/server/developer.js +++ b/scripts/server/developer.js @@ -501,15 +501,18 @@ function streamAudioURLToAllPlayersCommand(command, params, client) { // =========================================================================== -function streamEventStartToAllPlayersCommand(command, params, client) { +function streamAudioNameToAllPlayersCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; } - let volume = toInteger(params); + let splitParams = params.split(" "); + let name = splitParams[0]; + let volume = splitParams[1]; - playRadioStreamForPlayer(null, "https://dl.dropboxusercontent.com/s/xw4m0y0guyzrwkk/lets-get-ready-to-rumble.ogg", false, volume); + playAudioFileForPlayer(null, name, false, volume); + //https://www.dropbox.com/s/xw4m0y0guyzrwkk/lets-get-ready-to-rumble.ogg?dl=0 } // =========================================================================== \ No newline at end of file