Adding or replacing existing vehicleaudio.dat settings


This page explains how you can create your own vehicleaudio.dat files for your server, be it to add vehicle audio settings for your DL vehicles or to replace existing vehicleaudio.dat settings.


Overview of vehicleaudio.dat

As is the case with other data files which allow you to replace existing lines, it is highly recommended to work with an empty vehicleaudio.dat file. Only the files you place in your vehicleaudio.dat file really affect the game, so copypasting the stock GTA:UG vehicleaudio.dat file for your server is not necessary. A clean vehicleaudio.dat file looks like this:

; This is an empty vehicleaudio.dat file.
; This file does not have any sections in it... so of course there's nothing past this line :^)

Adding new vehicleaudio.dat lines

As you can see in the example above, there are no file sections in vehicleaudio.dat files. You can simply put your entries right at the top of the file and this is completely fine. You should fill the file with a individual entries for your DL vehicles. If you don't do this, the game won't play any audio when you use your vehicle. As for adding new vehicle audio settings, here's how a simple vehicleaudio.dat line looks like:

; ModelName                                 VehicleType   Engine sounds Stereo    Bass depth   Unknown      HornTon   HornHigh     DoorSound   Unknown    RadioNum   RadioType   PoliceScannerName EngineVolumeBoost
ul_deviant                                  0             101    100    0         0.9          1.0          8         1.05946      1           0          1          0           2                 0.0

So, as you can see, our example line represent the vehicle audio settings from the now deleted Deviant. Let's dissect the individual columns a bit more:


Column name Description
ModelName The name of the model for which you want to add vehicle audio settings.
VehicleType The vehicle sound type to use. Use 0 for cars, 1 for bikes, 2 for bicycles, 3 for boats, 4 for helicopters, 5 for planes, 8 for trains, 9 for trailers, and 10 for "special" vehicles.
Engine sounds The sound bank IDs for your vehicle. The first ID is the acceleration sound, and the second is the deceleration sound. See this page for a full list of sound bank IDs. GTA: Underground adds extra sound IDs for the VC PCJ-600. Refer to the stock GTA: UG vehicleaudio.dat file for the bank IDs UG uses.
Stereo The stereo mode. This column is tied to the Radio EQ option in the pause menu. You might have noticed the radio sounds a bit more "scratched" while riding a bike. This parameter controls that behavior. Use 0 if your vehicle should not play radio tracks with any equalizer effects at all (used for anything that isn't a bike), 1 if your vehicle should have the bass boost effect, and 2 if you want the radio to play with the "scratched" effect (used for bikes).
Unknown N/A
HornTon The horn sound ID used for the horn. You should go in-game and see which vehicle uses your desired horn sound ID, and then get the horn sound ID from the GTA:UG vehicleaudio.dat file.
HornHigh The pitch of the horn. A value of 1.0 is the default.
DoorSound The door sound ID used for the doors. You should go in-game and see which vehicle uses your desired door sound ID, and then get the door sound ID from the GTA:UG vehicleaudio.dat file.
Unknown N/A
RadioNum The radio station ID. You can only specify stock GTA:SA radio station IDs. Refer to this page for the GTA:SA radio station IDs; however do note that Playback FM starts at ID 1 and that Radio Off and User Tracks use ID 13 and ID 12.
RadioType The type of radio used by this vehicle. Use -1 if this vehicle should not play any radio at all, 0 for civillian radio, 1 for "special" radio, and 3 for the police scanner.
PoliceScannerName The purpose of this column is not fully known, except that it's related to the police scanner.
EngineVolumeBoost A multiplier for the engine volume for this vehicle. A value of 0.0 means no multiplier is applied.

Replacing vehicleaudio.dat lines

Now that we know how to add new vehicleaudio.dat entries, it's time to try and replace some existing lines. The way you do this is essentially the same as when you add new lines - the only difference is that we need to get the model name of the vehicle whose vehicleaudio.dat line should be replaced. You can obtain this by browsing the vehicles.ide file in the data folder in your game installation directory. You may replace a vehicleaudio.dat line multiple times - however once you call RemoveDataFile the initial settings will be restored. In other words, the first vehicleaudio.dat line that was added.


Making the game load your custom vehicleaudio.dat file

Now that we've added or vehicleaudio.dat lines, it's time to tell the file loader as well as our downloader about our new file. We will assume that the file is stored under assets/vehicleaudiodl-test/vehicleaudiodl-test.dat in this example.

With that said, your assets.json should look like this:

[
    ...
	{
		"name": "Vehicle audio DL - Test for vehicle audio DL",
		"author": "dkluin",
		"type": "vehicleaudiosets",
		"files": [
			"vehicleaudiodl-test/vehicleaudiodl-test.dat"
		]
	}    
]

...and our OnGameModeInit like this:

public OnGameModeInit()
{
    ...

    // Tell the file loader about our vehicleaudio.dat file
    AddDataFile("vehicleaudiodl-test/vehicleaudiodl-test.dat", DATAFILE_VEHICLEAUDIOSETS);
    return 1;
}

After following these steps you may restart your server to see the changes.