[Release] Play Custom Sounds for Interactions

InteractSound

Version: 0.2.1
By Scott

I am going to start releasing some of my smaller scripts, and then possibly some of the bigger ones.

The first on my list of scripts to release is my InteractSound which I essentially use to play interaction sounds that are not included within GTA V’s sounds. For example, handcuff sound effects. Or, a warning tone for a server restart, etc.

This particular script will allow you to play any .ogg sound file on any single client, all clients, or only clients within the specified range of the player’s Ped for the player you pass it. I plan to extend the distance-related event to include the functionality of making the audio file play quieter the further you are away from the “source”. The resource really only provides events and an NUI interface that runs in the background to play the sounds.

As with 95% of the work I do, this script (among with others) is very well documented both with comments in the script and the documentation page which is linked below.

Let me know if you have questions! Reply here or find me on Discord. It’s the same name in both places.


You can download the script here or access the documentation here. Visit my GitHub here.

36 Likes

is there a key or command to activate the script or is it just activated by running it?

3 Likes

This is a resource with events meant to be triggered from other scripts or your own key bindings. Basically the scaffolding to play alert tones/sound effects in your own scripts without relying on GTA V’s audio library.

Fantastic, thanks! I love the idea of a cuff sound. But so many possibilities…

Thanks @Scott! Been waiting for something like this!

This is great! I do have one problem though, I was testing the PlayOnSource, and after the sound was done, it make a click/beep noise and replayed it over and over. So my question is, is there anyway to end the sound once it’s finished or in the middle?

1 Like

It will only play once. Are you sure your sound file doesn’t play twice?

2 Likes

Hmm, it is a 2:06 ogg, 2.4mb. Could it be because the file it too large/long?

It should have no problem playing any size unless the CEF interface restricts it. I’m not aware of a restriction, though. So, the file completes and starts over? And you can confirm this? Or does the audio file itself have sounds that repeat in it? Because this script does not play a click/beep at any point. That has to be coming from your audio file.

1 Like

The file did complete and start over. However, after checking it, I found that it does play a slight click at the very end of it. When I shortened the audio file to ~30s it works fine. So the only thing I can think of was that the file was too long or too large, but that’s on my end. Thanks for such a fast response! I appreciate the help.

Sure thing! Let me know if you have any further issues with it. Happy to help.

@scott Just wanted to thank you again for addressing my issues.

I have successfully streamed the demo sound to all players using the following script
(written in the es_admin/sv_admin.lua).

  elseif commandName == 'Play' then
  TriggerEvent('InteractSound_SV:PlayOnAll', 'demo', 1.0)
  CancelEvent()
3 Likes

Just wondering if its possible to stream vehicle sounds, or replace. Like replacing a vehicle?

1 Like

RESIDENT.rpf and STREAMED_VEHICLES_GRANULAR.rpf arent on the data files list? Are files from those rpfs streamable, i dont quite understand.

Is there any way to randomize which sound gets played when “locking” a car?

You’ll have to build that functionality yourself. However, a simple javascript function could do it.

Well to further advance my question - could you have a file with all the instances of vehicle names (provided by the game - ie: Maibatsu Penumbra {305}) along with the other 100+ vehicles, play a random lock / unlock sound provided in which group the car is in?

Sport
4x4
Classic
Cheap

?

Sorry for the delay, but, yes, however you’d need to develop that yourself.

Why music stop and does end ?