Adding Custom Sounds

In Vehicle Keys we can configure custom sounds when using the key, but we require a certain dependency and use of code, in this document you will learn how.


To configure custom sounds we can use the following asset https://github.com/plunkettscott/interact-sound.

Once we have interact-sound, place the custom sound in the interact-sound folder as follows, Directory: interact-sound/client/html/sounds/carkeys.ogg.

Add the sound file name to the fxmanifest.lua file of the interact-sound resource. Example in fxmanifest.lua (you could have more sounds listed here):

-- Files needed for NUI
-- DON'T FORGET TO ADD THE SOUND FILES TO THIS!
files {
    'client/html/index.html',
    'client/html/sounds/demo.ogg',
    'client/html/sounds/carkeys.ogg',
}

To configure said system once we have done the previous steps, we must execute the following configuration with its appropriate values.

Config.Sounds = true -- Enable custom sounds through InteractSound
Config.SoundsDisableDefault = false -- Disable FiveM default sounds
Config.SoundsVolume = 0.3 -- Volume for custom sounds
Config.SoundsFileName = 'carkeys' -- Name of the custom sound file
Config.SoundsDistance = 2 -- Distance at which the sound can be heard

Last updated

Was this helpful?