InteractSound (Releases)

Play sounds on single clients, all clients, or only clients within a specific range.

Change Log

v0.0.1 - First Release First release includes the following server-only events:

  • InteractSound_SV:PlayOnSource
  • InteractSound_SV:PlayOnAll
  • InteractSound_SV:PlayWithinDistance

First release includes the following client-only events:

  • InteractSound_CL:PlayOnOne


InteractSound is simple to use. The code is well-commented and is relatively simple in nature so there is nothing too advanced that needs a lot of explaining.

TriggerServerEvent ...
InteractSound_SV:PlayOnOne             - Accepts 3 Parameters:



InteractSound_SV:PlayOnSource          - Accepts 2 Parameters:


InteractSound_SV:PlayOnAll             - Accepts 2 Parameters:


InteractSound_SV:PlayWithinDistance    - Accepts 3 Parameters:



TriggerClientEvent ...
InteractSound_CL:PlayOnOne            - Accepts 2 Parameters:


Parameter Descriptions
   The network id of the player to receive the interaction sound.

   The sound file \(minus the .ogg file extension\) of the file within the client/html/sounds/ directory.

   The volume, in range of 0.0 to 1.0 at which to play the audio file.

   The maximum float distance away from the player Ped which is passed for the sound to be broadcast. This uses the Vdist      GTA V native to check if each Ped is within the maxDistance value passed. If they are, the sound is played.

Adding Sound Files

Because sound files are a part of the NUI, you must add the sound file to the client/html/sounds/ directory within the InteractSound resource and they must be of the .ogg type. You will not be able to use .mp3 currently.

Once you add the .ogg files to the client/html/sounds/ directory within the resource, you will need to open the __resource.lua file and modify the following portion:

    -- Begin Sound Files Here...
    -- client/html/sounds/ ... .ogg

You will need to add the full path to the file within the codeblock. Look at the pre-packaged demo.ogg file for an example of how to properly add files.

Pre-Packaged Demo

InteractSound comes with an included demo.ogg file which is ready to be triggered for testing purpose. To send this sound to all players within a vehicle, use the following example from the client:

TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 0.5, 'demo', 1.0)

Or, to trigger this from the server, do the following:

TriggerEvent('InteractSound_SV:PlayWithinDistance', 0.5, 'demo', 1.0)

Questions? Bugs?

Please let me know on Discord or via a response to the initial form post for InteractSound. My name is "Scott" on the FiveM Discord as well as the forums.

results matching ""

    No results matching ""