Got a server.cfg full of single-car resources? You can put many cars into one resource without merging their meta files by hand. Here's the folder layout and fxmanifest that make it work.
TL;DR:
-
Make a new resource folder with a
dataand astreamfolder. - Give every car its own subfolder in both, named after its spawn name.
-
Use one fxmanifest that loads
data/**/meta files. - Copy custom sound files and their fxmanifest lines for cars that have them.
- Check no two cars share a modkit or siren id.
-
Replace the old
ensurelines with the new resource and restart.
Jump to
1. Make the new resource
Make a new folder in resources, for example mycarpack, with a data and a stream folder inside.
2. One subfolder per car
Copy each car into its own subfolder, named after its spawn name. The meta files go in data, the model and texture files in stream, and tuning parts in a mods folder inside the car's stream folder:
๐ mycarpack
โโโ ๐ data
โ โโโ ๐ car1 โ car1's carcols, carvariations, handling, vehicles, vehiclelayouts
โ โโโ ๐ car2
โโโ ๐ stream
โ โโโ ๐ car1 โ car1.yft, car1_hi.yft, car1.ytd, car1+hi.ytd
โ โ โโโ ๐ mods โ car1's tuning parts
โ โโโ ๐ car2
โโโ ๐ fxmanifest.luaKeeping every car in its own folder means you never have to merge meta files, and it's easy to see which file belongs to which car.
3. The fxmanifest
One fxmanifest.lua in the root of the resource loads every car's meta files. The ** means "in any subfolder", so a new car only needs its folders, no manifest changes:
fx_version 'cerulean'
game 'gta5'
files {
'data/**/*.meta'
}
data_file 'VEHICLE_LAYOUTS_FILE' 'data/**/vehiclelayouts.meta'
data_file 'HANDLING_FILE' 'data/**/handling.meta'
data_file 'VEHICLE_METADATA_FILE' 'data/**/vehicles.meta'
data_file 'CARCOLS_FILE' 'data/**/carcols.meta'
data_file 'VEHICLE_VARIATION_FILE' 'data/**/carvariations.meta'Keep the VEHICLE_LAYOUTS_FILE line above the other data files. The layouts have to be loaded before the cars that use them, otherwise those cars can end up with broken seats and animations. If none of your cars have a vehiclelayouts.meta, you can leave that line out.
4. Cars with custom sounds
Some cars come with their own engine sound. You'll see it as an audioconfig folder with .rel files and an sfx folder with .awc files, plus extra lines in the car's fxmanifest.
If you move a car like that into the pack, copy both folders into the root of the pack and copy its sound lines into the pack's fxmanifest too. Use the file names from the car's own fxmanifest, they're different for every sound:
files {
'data/**/*.meta',
'audioconfig/*.dat151.rel',
'audioconfig/*.dat54.rel',
'sfx/**/*.awc'
}
data_file 'AUDIO_GAMEDATA' 'audioconfig/mysound_game.dat'
data_file 'AUDIO_SOUNDDATA' 'audioconfig/mysound_sounds.dat'
data_file 'AUDIO_WAVEPACK' 'sfx/dlc_mysound'The car's vehicles.meta picks the sound with audioNameHash, so leave that as it is. If you leave the sound files out, the car still spawns but uses a default GTA engine sound.
Sound packs that several cars share are easiest to keep as their own resource. Just make sure it's still started with ensure.
5. Check for clashing ids
Cars that worked fine on their own can clash once they're in the same pack. Two things to check:
-
Modkit ids in
carcols.meta: every car needs its own. If two cars share one, tuning parts mix up between them. See Fixing Modkit ID Conflicts. -
Siren ids in
carcols.meta: emergency cars with different lightbars need different siren ids, or one car gets the other's lights.
6. Swap it in
Remove the old single-car resources from resources (or move them out), replace their ensure lines in server.cfg with one line, then delete the server cache and restart:
ensure mycarpackSpawn each car once to check it still works.
FAQ
Do the cars load faster in one resource?
The cars themselves load the same. What you get is a shorter server.cfg and fewer resources to keep track of.
Can I merge escrowed cars?
No. Escrowed resources are locked, so they have to stay as they are.
A car stopped spawning after combining. Why?
Usually its files ended up in the wrong folder, or its meta files aren't in a subfolder of data. Go through Vehicle Not Spawning in FiveM.
Can two cars use the same spawn name?
No. Every car needs its own spawn name, or only one of them will load.
My car lost its custom engine sound after combining. Why?
Its audioconfig and sfx folders or its audio lines in the fxmanifest didn't come along. Copy them over as shown in step 4.
Need help?
Open a ticket on our Discord and we'll take a look:
0 comments