[HELP] Vehicle addon parts problem

car
handling
meta
addon

#1

Hi, I’m writing because I have encountered a really inconsistent problem with a server I’m trying to setup and I have reached a dead end.

I am trying to make 2 separate addon cars out of the same vehicle – one would have grip handling, the other drift one. I’ve made all the changes to the drift one (all the model and texture names, fields in .meta files, parts names, modkit IDs, etc.). Server registers the addons fine, both cars can be spawned by client, but there is a problem with mod parts (spoilers, engine upgrades, etc.). Sometimes they spawn fine and sometimes all the mods for the car are non-existent.

I’ve been trying to figure out why is it happening and did some tests, this is how it behaves rn:

  • When restarting the client’s FiveM and joining the session for the first time (since app restart) the mods do not work
  • When rejoining the session without exiting/restarting FiveM – everything suddenly starts working – can spawn modded parts for both cars

The addon car I am using is 2017 Nissan GTR (https://www.gta5-mods.com/vehicles/2015-nissan-gtr-nismo-yca-y97y).

It would be amazing if someone could point me in the direction of what may cause such inconsistencies, I’ve been struggling to set it up for a while now.


#2

So, after struggling with this problem for quite a while I think that I finally found a solution:

The order of declaring .meta files in your __resource.lua is crucial. I had some files declared in the wrong order and therefore my client did not read all of them (especially carcols.meta) upon the first connection to the server.
The correct order should be declared as follows:

resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'

files {
    'data/vehicles.meta',
    'data/carvariations.meta',
    'data/carcols.meta',
    'data/handling.meta',
    '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'
data_file 'VEHICLE_LAYOUTS_FILE' 'data/vehiclelayouts.meta'


client_script {
    'vehicle_names.lua'
}

When you declare those files in this order all should be good.