Use extra resource for custom audio files

This commit is contained in:
Vortrex
2021-10-25 12:58:42 -05:00
parent a52cfb40f5
commit 04c0443b37
2 changed files with 17 additions and 10 deletions

View File

@@ -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);
}
// ===========================================================================

View File

@@ -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
}
// ===========================================================================