Vehicle sounds and audioNameHash

I’ve spent the last few days reading over a ton of threads and guides on how vehicles work. I’ve learned a lot, but one thing I haven’t figured out is the audioNameHash.

Clearly, it seems to control every aspect of sound the car makes. My question is there anyway to pick and choose what sounds I want?

Example: Say I wanted an emergency SUV to have the lifeguard noises. I’d use LGUARD for the audionamehash. But lets say I also wanted it to have a cop horn. How would I go about doing that?

1 Like

You can use CodeWalker (v30 previews, probably only available on their Discord) to edit (and create new) game.dat files - these audioNameHash entries lead to entries in said game.datN.rel files.

To use them in-game, then, you should use a data_file entry - however you can only add new entries, not replace existing ones.

For example, in your resource.lua, once you have a dlcmyvehicles_game.dat151.rel:

file 'dlcmyvehicles_game.dat151.rel'
data_file 'AUDIO_GAMEDATA' 'dlcmyvehicles_game.dat'
1 Like

Here’s an example of a minimal file you can import in CodeWalker v30_dev13’s RPF explorer (enable edit mode, make a new RPF called ‘something.rpf’ or so, right click and ‘import XML’, then drag the file out in your resource’s directory - you can’t yet directly import XML files outside of RPFs sadly):

dlcmyvehicles_game.dat151.rel.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Dat151>
 <Version value="7126027" />
 <Items>
  <Item type="Vehicle">
   <Name>lguard_custom</Name> <!-- this is the audioNameHash you will use, you can't replace existing ones though! -->
   <Unk00 value="0x90005A68" />
   <Engine>hash_31AC9D20</Engine>
   <EngineGranular>hash_B8DFEA30</EngineGranular>
   <Horns>hash_134DA50D</Horns> <!-- I replaced these with the Horns from the "police" -->
   <DoorOpen>hash_9BA234E5</DoorOpen>
   <DoorClose>hash_30FD4077</DoorClose>
   <TrunkOpen>hash_71BF0F14</TrunkOpen>
   <TrunkClose>hash_B58A7E0A</TrunkClose>
   <Unk08>null_sound</Unk08>
   <Unk09 value="0.5" />
   <SuspensionUp>hash_7CEDC837</SuspensionUp>
   <SuspensionDown>hash_4AEF38F3</SuspensionDown>
   <Unk12 value="0.4" />
   <Unk13 value="1" />
   <Unk14>hash_00C2FB47</Unk14>
   <Unk15 value="0" />
   <Unk16 value="0" />
   <Unk17 value="0" />
   <ScannerParams>hash_B612E618</ScannerParams>
   <JumpLandIntact>hash_A5EB71C0</JumpLandIntact>
   <JumpLandLoose>hash_1AF1FCAC</JumpLandLoose>
   <Unk21 value="31" />
   <Unk22 value="36" />
   <RadioFlags value="0x00010001" />
   <IndicatorOn>hash_D4314DE2</IndicatorOn>
   <IndicatorOff>hash_A683DC21</IndicatorOff>
   <Handbrake>hash_97DEEC51</Handbrake>
   <Unk27 value="0x00010001" />
   <Unk28>hash_674E1F4D</Unk28>
   <Unk29 value="0x55FC0070" />
   <Unk30>hash_795E90E6</Unk30>
   <Unk31>hash_795E90E6</Unk31>
   <Unk32>hash_2FF627AC</Unk32>
   <StartupSequence>hash_B807DF3E</StartupSequence>
   <Unk34>null_sound</Unk34>
   <Unk35>hash_F52E6D86</Unk35>
   <Unk36>hash_F52E6D86</Unk36>
   <Unk37 value="6" />
   <Unk38 value="3" />
   <Unk39 />
   <Unk40 value="0" />
   <Sirens>hash_49DF3CF8</Sirens>
   <Unk42 value="0" />
   <Unk43 value="0" />
   <Unk44 value="0" />
   <Unk45>hash_0C3F6AD5</Unk45>
   <Unk46>hash_359E05CB</Unk46>
   <Unk47 />
   <TurretSounds />
   <Unk49 value="8" />
   <Unk50 />
   <Unk51 />
   <Unk52 value="0" />
   <ElectricEngine />
   <Unk54 value="0" />
   <ReverseWarning>null_sound</ReverseWarning>
   <Unk56 value="3" />
   <VehicleMaster>null_sound</VehicleMaster>
   <ShutdownBeep>null_sound</ShutdownBeep>
   <Unk59 value="1" />
   <Unk60 value="0" />
   <Unk61 value="1" />
   <Unk62 value="0" />
   <Unk63>null_sound</Unk63>
   <Unk64 value="0" />
   <Unk65 value="0" />
   <Unk66 value="0" />
   <Unk67 />
   <Unk68>null_sound</Unk68>
   <Unk69 />
   <Unk70 value="0" />
   <Unk71>null_sound</Unk71>
   <Unk72>null_sound</Unk72>
  </Item>
 </Items>
</Dat151>
2 Likes

Wow! thank you two so much that is super helpful. I really appreciate it!

EDIT: The hash in the “” line is for the civilian horn only. If you want the “cop siren” you need to add the “FLAG_LAW_ENFORCEMENT” to the vehicle.meta flags section.

I’m still having a few issues sadly:

So what I’ve done:
Changed vehicles.meta lguard_custom
Added the above .xml to something.rpf in CodeWalker and dragged out the dat151.rel into the resources folder.

Added the above to my lua file.

The sound works, but it’s just the normal lguard horn, despite the cop horn being in the .xml. I went and double checked the vanilla files and the cop horn definitely seems to be hash_134DA50D so i’m not sure what the issue is

Info dump:

[snip]

Can you send me your file so i can reverse engineer it and get a better understanding? I’m trying to reproduce the sound of the handbrake that the ped makes when it leaves the vehicle

Unfortunately I haven’t messed with this stuff or played FiveM in years and have very little memory of what I learned. (only reason I even saw this is because this forum sent me an email about your response) I looked around my computer but I can’t even find the files related to this anymore.

Sorry I can’t be of help. Good luck!

if its customizable at benny just go put a cop horn on it that way

I’m having major issues with not having any vehicle audio at all from a particular vehicle in my server, but everyone else seems to have the audio for it? I’ve cleared my FiveM Cache and thought it would have something to do with the audio hash’s…Any help? Rebooting this thread!