New year, new weather, change the theme of the blog, the old theme can be retired (anyway, it is ugly to death because of my messing around…)
Back to the topic. For a long time, my FiveM server had a problem, that is, some add-on (Addons) vehicle modification parts will be lost, and nothing can be changed unless the vehicle file name corresponding to the restart is manually performed after entering the game. Modification, in fact, I wanted to study this issue very early, but I have no idea.
Just happened to browse the FiveM forum last night when I had nothing to do, and searched this question out of curiosity, only to find that someone had already asked it. The reason for this problem starts with the configuration of GTA5. Each vehicle of GTA5 has its own configuration.
In summary, there are probably the following files:
- meta, which specifies the physical behavior of the vehicle, such as weight, grip, suspension, acceleration, etc.
- meta, the properties of the vehicle, records the type of vehicle, basic information, model file name, etc.
- meta, vehicle modification information, including visual appearance modification, power modification, etc.
- meta, this should be regarded as recording the color of the vehicle and the modification kit ID value, etc.
- meta, what is this thing that has not been researched
- meta This file records the seat information of the vehicle, usually, only the right-hand drive vehicle has this file
Among them, vehicles.meta refers to the contents of handling.meta; carvariations.meta refers to the contents of carcols.meta.
Then each vehicle needs a __resource.luafile , and the problem of lost vehicle modification is here. The order of several data_file parameters in this file is very important, and once it is wrong, the vehicle will not be available. Modifications and even game crashes. Here is an example of an incorrect configuration file:
We can see that carvariations.meta is loaded first at the top, but at this time carcols.meta has not been loaded into memory (scripts are executed from top to bottom), so the game cannot read carcols.meta data, and then cause an error, which can also explain why the modified part comes out after restart: when you enter the game for the first time, carcols.meta is loaded into memory later than carvariations.meta, and after loading carvariations.meta At that time, there was no carcols.meta data in the memory, so the car had not been modified; after you restarted, there was already carcols.meta data in the memory, and the modified parts came out naturally.
Knowing this reason, we just need to arrange the data_file in the following order:
Example of a correct configuration file:
Note that vehiclelayouts.meta must be placed at the front (it can be behind dlctext), otherwise the vehicle will not be able to ride after being refreshed or it will crash as soon as you get on the vehicle.
In addition, the original CARCONTENTUNLOCKS_FILE has been changed to CONTENT_UNLOCKING_META_FILE after the FiveM update, remember to modify it or an error will be reported.