How to mass add vehicles [Add-on & Replace]

Hello, this is my first ever tutorial on the forums so be nice and give me some feedback :slight_smile: Ok so in this post I am going to help you add loads of cars all into 1 resource easy. I have not seen a tutorial on this so far and it would have helped me if I saw this when starting out. This 100% works with add-ons and tell me down below if it doesn’t with replace.

Ok, so we start assuming you have collected all the vehicle files, modification files, and the .meta files.

  1. Create the main resource. You can name this what you want and this will house all the cars. Make sure to add this to the autostart .cfg file that you use for your server.

  2. Download the cars you want and get all the files you want using openiv or if it comes FiveM Friendly

  3. You will need a stream folder and a data folder. This will consist of 2 parts.
    a) In the stream folder create another folder with the cars name and put all the car files in here (ytd’s and ytf’s) make sure you remember the name of the stream folder to make things clean you will use it again.
    b) Open the data file and create a folder with the same name as the one in the stream folder and this is where all the .meta files will be for this car.

  4. Now go into the resource.lua (Example will be attached to help) and for each car you add you will need to do the below:

    'data/foldername/vehicles.meta',
    'data/foldername/carvariations.meta',
    'data/foldername/carcols.meta',
    'data/foldername/handling.meta',
    'data/foldername/vehiclelayouts.meta',

    data_file 'HANDLING_FILE'                      'data/foldername/handling.meta'
    data_file 'VEHICLE_METADATA_FILE'    'data/foldername/vehicles.meta'
    data_file 'CARCOLS_FILE'                          'data/foldername/carcols.meta'
    data_file 'VEHICLE_VARIATION_FILE'   'data/foldername/carvariations.meta'
    data_file 'VEHICLE_LAYOUTS_FILE'       'data/foldername/vehiclelayouts.meta'

It DOES NOT matter if you do not have one of the files just make sure you add all, it works fine like that for me.

In the future I might be releasing a pack I have added to over time, none of the vehicles are mine but when I release it I will link it in this topic. Keep your eyes open :eyes:

__resource.lua (644 Bytes)

I hope this helps you and if you need any help or have any tips for my future posts please leave them below!

  • Ethan
7 Likes

Nice Job :snail: Maybe a templated addon pack ?

3 Likes

Yes I am working on that like it says on at the end about me working on my release for a pack of custom cars, sadly I didn’t make them though

OMG u are a life saver! Thanks so much

1 Like

Okay so i’ve set everything up like this
image

then i open vehicles and I have my data and stream folders
image

then I open stream and put in my vehicle files ytd’s/ytf’s in each vehicle folder
image

then i open data and put in my .meta files for the vehicles
image

then I put all of the text in __resource.lua like this

then I type in my resource autostart config file
“start vehicles”

Everything seems to load up fine, no errors in my server console, however I still can’t spawn the vehicles? I try “/car benson3” which works to spawn it if i give it an individual __resource.lua, but it doesnt work in this mass __resource.lua. I also try “/car uktaxi” which is what i’ve named the taxi mod as it was a replacement vehicle that i’ve converted to an add-on.

anyone know why?

2 Likes

Ok thank you for the reply and some others may have this issue. I am not sure if I put this wrong in the instructions or what but what you want is the __reousrce.lua then the data folder and stream folder. You can have the vehicle folder and then inside of that have the data and stream folders but you will have to change all the __resource.lua to say, for example in your case, below:

files {
    'vehicles/data/foldername/vehiclelayouts.meta',
}

If you do not want to go through each one in the file and change it just bring the data and stream folder out of the vehicles folder and then delete the vehicles folder and then inside the main resource folder that contains the __resource.lua you would have the reousrce lua, data folder and the stream folder. This may sound complicated so I will put some screenshots below on what mine looks like.

image This is the main folder in the resources for the server. Within this:
image Hope this makes sense and if it doesn’t just say and I can help you out over discord further.

Good luck with adding the vehicles and I hope this helps you. Have a good day :smiley:

1 Like

Ay it came through, i tried setting it up using this:

files {
‘vehicles/data/foldername/vehiclelayouts.meta’,
}

but it still wouldn’t work, not sure if it’s because something else is messed up. Like, everything already seems to load, I don’t get any errors saying “cant load resource: vehicles” or anything like that, I just simply cant spawn the vehicles in game.

Starting to think it might be an issue with my meta files. Anyway, i’m gonna set it up like yours and see if that works.

Do you setup your .cfg file like “start import-cars” then?

remove the , at the end of the line…

files {
'vehicles/data/foldername/vehiclelayouts.meta',
}

so it will look like

files {
'vehicles/data/foldername/vehiclelayouts.meta'
}

see my example:

files {
    'data/sq72016/vehicles.meta',
    'data/sq72016/carvariations.meta',
    'data/sq72016/carcols.meta',
    'data/sq72016/handling.meta',
    'data/sq72016/dlctext.meta'
}

At least this way works for me
see: https://docs.fivem.net/docs/scripting-reference/resource-manifest/resource-manifest/

Work for me with it but if that fixes it then there you go :slight_smile:

Where do i find the modification/meta files. Every car i download i can only ever find the ytd’s & ytf’s

And what about doing it this way:

__resource.lua (475 Bytes)

I’d be interested in downloading it, if it works! I’m just getting into this whole having a server thing and any way to make it easier to add large packs of cars would be great lol

I can probably do a video tutorial on this subject on my YouTube channel because I’m about to finish my ro server and this old method is overly complicated its alot easier than you think so I can always share my method if you guys want

2 Likes

Works great!
Have made 't step by step and couple of times it not working but now chears for this

You wouldn’t mind sharing your method, would you?
Also, @squizer, this method works, except in Linux-based servers. :thinking:

We were running on Linux and had issues. Do not ise the version (my edit of resource).

1 Like

Do NOT use it (my editted __resource.lua). It will broke car pack :slight_smile:

1 Like

Ah, yes! The resource works perfectly in Windows-based servers though. I’m glad that it does, except I am also testing this resource in a Linux-based server; the issues indeed persist like you’ve said. I am inclined to believe that there is a potential issue with globbing in the latest Linux master build. :thinking:

@squizer, I’ve resolved this! See the solution here in my thread. :blush:

I have a problem with this…
I have car script in server cfg.
When I connect to server I can spawn car but withuot of modyfication, when i restart scirpt then modyfication work. (im still in serwer)
But if I reconnect to server I donth have option do modyfication. Somone can tell me what to do witth this?

or just use globbing
files {
‘**/*.meta’
}

2 Likes