There are two ways to give a vehicle a custom engine sound:
audioNameHashinvehicles.metafixes the sound for a vehicle model. It is read when the model loads, so it cannot change per vehicle.ForceVehicleEngineAudiois a native that overrides the sound for one vehicle at run time. This resource uses it, driven by a state bag, so any script can change a single vehicle without touching the model.
The name you pass must match the audio object defined inside the pack (the entry in its dat151 game data and dat54 sound data), not the folder name or the label. The name in sound.json is that audio object name.
Demo aliases#
The download ships four demo alias packs so you can hear a change straight away: demo_adder, demo_zentorno, demo_sultan and demo_voltic. An alias pack has no audio files. Its sound.json names a vanilla GTA engine sound:
{ "name": "demo_adder", "label": "Demo: Adder W16", "tier": 3, "builtin": true, "audio": "adder" }
The generator writes no data_file lines for it, and SetVehicleSound(netId, 'demo_adder') forces the adder sound. Try one in a vehicle with the test command above. The demos use vanilla GTA audio, not audio from this resource. They are placeholders: delete the packs/demo_* folders and run the generator when you add your real packs.
Exports#
Server and client:
exports['glitch-engineSounds']:GetPacks() -- { { name, label, tier, pack, category? }, ... }
exports['glitch-engineSounds']:GetPack('my_2jz')
exports['glitch-engineSounds']:IsInstalled('my_2jz')
Server only:
exports['glitch-engineSounds']:SetVehicleSound(netId, name) -- name must be an installed pack, nil or '' clears
Client only:
The client checks names by pattern only (letters, digits, _ and -, up to 64 characters). Server-set sounds are validated against installed packs; ApplyToVehicle is local to that player and accepts any valid audio name. Vehicles set this way are left alone by the rescan until a server-set sound replaces them.
exports['glitch-engineSounds']:ApplyToVehicle(vehicle, name) -- this client only, nothing is replicated
The list is read once when the resource starts, so restart it after running the generator.
Generator#
node tools/generate-sounds.cjs scan packs/, rewrite the generated block of fxmanifest.lua and sounds.json
node tools/generate-sounds.cjs --check validate packs, write nothing
node tools/generate-sounds.cjs --selftest build a fixture pack in a temp folder and check the output
node tools/generate-sounds.cjs --inspect packs/my_2jz list candidate audio object names found in a pack
The self-test confirms the data_file lines, sounds.json, a repeat run giving identical output, and that a stray .exe or a bad sound.json is rejected. Run it after you change the generator.
| File type in a pack | Registered as |
|---|---|
.awc |
AUDIO_WAVEPACK, pointing at the folder that holds it |
*.dat151.rel |
AUDIO_GAMEDATA, as *.dat |
*.dat54.rel |
AUDIO_SOUNDDATA, as *.dat |
*.dat10.rel |
AUDIO_SYNTHDATA, as *.dat |
With alias packs only, the generated block in fxmanifest.lua stays empty. That is expected: aliases need no data_file lines.
Only the block between -- BEGIN GENERATED and -- END GENERATED in fxmanifest.lua is rewritten. Do not edit inside it.
Finding the audio object name#
--inspect reads the .rel and .dat files of a pack and prints the readable names it finds, with likely engine objects first. It is best effort: names stored only as hashes are not shown, unrelated strings can appear, and it cannot say which entry is the engine. Use it to narrow the list, then confirm the name with the pack author.
sounds.json#
The generic list any script can read:
{ "packs": [ { "name": "my_2jz", "label": "2JZ inline six", "tier": 3, "pack": "my_2jz", "category": "motorcycle" } ] }
pack is the folder name. category appears only when set.