[Release] Play Custom Sounds for Interactions

It’s not his fault he unfortunately can’t change it.

yea i know :slight_smile: just hoping fivem will fix it because could be funny, but 20 secs of music is not worth to lisen to it

Depends on which event you trigger. There are events for server-wide sound.

1 Like

If I get some downtime I’ll try to look into this and see if there is another way to do it. I’ve got a lot of other projects in the works that are taking up my time.

i know i know what it is to develop, am a developper too. juste made esx_dj :slight_smile:

can i use this to make a custom “scripted” phone conversation?
you know like gta:online has the phone pop up and someone like agent14 talks about buying a bunker

Sure. Play it for the client who should hear it only. There is a length limitation, though.

1 Like

Hey, i want to activate the sound effect by typing /audio in chat and i dont really know how to buildup the lua that would do it can someone help me?

An example using EssentialMode’s addGroupCommand:

Server

TriggerEvent('es:addGroupCommand', 'audio', "user", function(source, args, user)
	TriggerClientEvent('audio:commandTriggered',source)
end)

Client

RegisterNetEvent('audio:commandTriggered')
AddEventHandler('audio:commandTriggered', function()
	--Trigger the interaction sound
	TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 0.5, 'demo', 1.0)
	
	--Do whatever else you want the client to do...
end)
4 Likes

he can someone help when i call this it only seems to work with the demo file - i renamed my audio file to demo and it played if it try to call any sound other than demo it does nothing

in the console windows (F8) i get the error

nui://interactsound/client/html/index.html:0, Uncuaght (in promise) NotSupportErrotr: failed to load because no supported source was found.

i have added the files to the resource

files({
‘client/html/index.html’,
– Begin Sound Files Here…
– client/html/sounds/ … .ogg
‘client/html/sounds/demo1.ogg’,
‘client/html/sounds/demo.ogg’
})

4 Likes

Hi there, have a uestion. Is it possible to set this up to play for Cop Group only in VRP Servers. I noticed the files mentioned ped id’s. Just curious if that could be done. and the same like with Fire/EMS like dispatch tones. Thanks.

well if you made the sound only play when say you “handcuff” a player, then it would only be for the police that can make the sound.

As for other police hearing it only, im not to sure. but you can set the distance very low so that only that player that initiated the sound can hear it

What im curious to know is, if anyone knows how to get this to play a live ogg radio stream

Is it possible to make a command in the script to do for a instance /somthing then it would execute the sound file how could i do it? can i have a snippet? tnx // NovelaxNeko

1 Like

Fast answer, Create a command that trigger the sound event for the source, easy.

Has anyone successfully played a whole song using this script? like 2-3 min, im trying to do it with a DJ script, but it only works for like 3-10 sec

I cant get this workin.

I add this to my plugin:

TriggerServerEvent(‘InteractSound_SV:PlayWithinDistance’, 10, ‘demo’, 1.0)

Nothin is played… Why?

And yes im sure that i add the triggerevent to the right place.

Same here. Any solution yet?

Try this:
TriggerServerEvent(‘InteractSound_SV:PlayWithinDistance’, 10, “demo”, 1.0)

I restart the discussion, I have the same problem as Patrik_Tjernstrom, my sound only lasts 10 seconde while it lasts 2 minutes, someone can help me ?
( Sorry for translate i french boy )