How to add an add-on vehicle to a FiveM server

By Nilo3D · Updated:

To add an add-on vehicle to a FiveM server, put the model files (.yft, _hi.yft, .ytd) in a resource's stream folder and the meta files in a data folder. List the metas in fxmanifest.lua with files and data_file lines, add ensure to server.cfg, restart, and spawn the vehicle by its model name.

What is an add-on vehicle in FiveM?

An add-on vehicle is a vehicle with its own model name that is loaded next to the stock GTA V vehicles instead of replacing one of them. On FiveM it lives in a server resource: the server sends the files to every player who joins, so nobody installs anything by hand.

Add-onReplace
Model nameNew (for example mycar)An existing one (for example sultan)
Stock vehicleStays in the gameIs swapped out for every player
Meta filesNeeds its own vehicles.meta entryCan reuse the stock entry
Typical useServer cars, shops, job vehiclesVisual swaps of traffic cars

What are the steps, in short?

  1. Create a folder for the resource inside the server resources folder.
  2. Put the .yft and .ytd files in a stream subfolder.
  3. Put the .meta files in a data subfolder.
  4. Write an fxmanifest.lua that lists each meta under files and in a data_file line.
  5. Add ensure <folder name> to server.cfg and restart the server.
  6. Spawn the vehicle with its model name.

Each meta file also has its own guide, linked from the table in the next section.

What files does an add-on vehicle need?

An add-on vehicle is two groups of files: binary model files that go in stream/, and XML meta files that tell the game what the model is and how it behaves. The game only insists on the model, its textures and a vehicles.meta entry. The other metas add handling, colors, tuning and seats.

FileFolderWhat it doesNeeded?
mycar.yft, mycar_hi.yftstreamThe 3D model. See vehicle model files.Yes
mycar.ytdstreamThe texture dictionary.Yes
vehicles.metadataRegisters the model: name, type, layout, flags. See vehicles.meta explained.Yes
handling.metadataPhysics: mass, power, grip, suspension. See handling.meta explained.Only if the vehicle has its own handlingId
carvariations.metadataColor combinations, mod kit, light and siren settings.Recommended
carcols.metadataCustom tuning kits, sirens and light setups. See carvariations and carcols.Only for custom tuning parts or sirens
vehiclelayouts.metadataCustom seats, entry points and animations. See vehiclelayouts.meta explained.Only for custom seating or animations

Where do the files come from?

Vehicle packs made for FiveM already come as a resource with these folders. A vehicle downloaded as a single-player mod usually comes as a dlc.rpf archive. The same files are inside, but they have to be extracted and arranged into the layout below.

ToolUsed for
CodeWalkerBrowsing the game's archives, viewing models, and exporting stock .meta files to copy an entry from.
Blender with the Sollumz add-onImporting, editing and exporting vehicle models (.yft) and texture dictionaries (.ytd).
Any text editorEditing the .meta files and fxmanifest.lua, which are plain text.

The fastest way to write metas for a new vehicle is to copy the entries of the stock vehicle most similar to it and change the names.

To make or change the model itself, see how to make a FiveM vehicle in Blender with Sollumz. Turning a single-player dlc.rpf into a resource is in converting a single-player car mod to a FiveM add-on, and the two tools are compared in CodeWalker vs Sollumz.

What is the folder structure of a vehicle resource?

A vehicle resource is one folder inside the server resources folder with an fxmanifest.lua, a stream folder and a folder for the metas. The folder name is the resource name. The meta folder can have any name, and most people call it data.

resources/
  mycar/
    fxmanifest.lua
    data/
      handling.meta
      vehicles.meta
      carcols.meta
      carvariations.meta
    stream/
      mycar.yft
      mycar_hi.yft
      mycar.ytd

Files in stream/ are picked up by file name, so they are not listed in the manifest. Meta files get no such shortcut. Each one has to be declared in the manifest.

How do I write the fxmanifest.lua for a vehicle?

The manifest declares every meta file twice: once in files, so the server sends it to players, and once in a data_file line, so the game loads it as the right kind of data. Both are documented in the FiveM resource manifest reference.

fx_version 'cerulean'
game 'gta5'

files {
  'data/handling.meta',
  'data/vehicles.meta',
  'data/carcols.meta',
  'data/carvariations.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'
  • fx_version 'cerulean' and game 'gta5' are required at the top of every FiveM manifest.
  • A meta that is in data_file but missing from files never reaches the player, so the vehicle will not exist for them.
  • The type string must match the file: HANDLING_FILE for handling.meta, VEHICLE_METADATA_FILE for vehicles.meta, and so on. The full list is in the data_file reference for vehicles.

How do I start the vehicle resource?

Add one line with the resource folder name to server.cfg and restart the server. ensure starts the resource, or restarts it when it is already running.

ensure mycar

On a running server you can type refresh and then ensure mycar in the server console instead of a full restart. If a player who was already connected does not see the vehicle, have them reconnect.

How do I spawn the vehicle in game?

The spawn name is the modelName from vehicles.meta, which is also the name of the .yft file. Use it with any admin menu or vehicle spawn command. If the server has no spawn command yet, this client script adds /car mycar:

RegisterCommand('car', function(_, args)
  local model = GetHashKey(args[1] or 'mycar')
  if not IsModelInCdimage(model) then return print('model not found') end
  RequestModel(model)
  while not HasModelLoaded(model) do Wait(0) end
  local ped = PlayerPedId()
  local veh = CreateVehicle(model, GetEntityCoords(ped), GetEntityHeading(ped), true, false)
  SetPedIntoVehicle(ped, veh, -1)
  SetModelAsNoLongerNeeded(model)
end)

The name the game shows for the vehicle comes from gameName. It is a text label, so without a label the HUD shows the raw key. Register one from a client script:

-- client script: readable name for <gameName>MYCAR</gameName>
AddTextEntry('MYCAR', 'My Car GT')

Which names have to match?

Most add-on vehicles that fail to load have a name that does not match between two files. Each pair on a line below must be identical:

stream/mycar.yft                 <modelName>mycar</modelName>
stream/mycar.ytd                 <txdName>mycar</txdName>
handling.meta <handlingName>     <handlingId>MYCAR</handlingId>
carvariations.meta <modelName>   <modelName>mycar</modelName>
vehiclelayouts.meta <Name>       <layout>LAYOUT_STANDARD</layout>
carcols.meta <kitName>           carvariations.meta <kits><Item>

If the vehicle spawns but something is off (no textures, wrong physics, no tuning parts), go through the vehicle troubleshooting guide.

Does the framework matter?

No. A vehicle resource has no script that depends on ESX, QBCore or QBox, so the steps above are the same on every framework. The framework only comes in when the vehicle should be sold in a dealership or stored in a garage, which is covered in adding a custom vehicle to ESX, QBCore or QBox.

The Coil S-Cooter is a working example of this layout: a stream folder with the model, textures and animation dictionaries, and a data folder with handling, vehicles, carvariations, vehiclelayouts and clip sets, all loaded through data_file lines with no script.

Frequently asked questions

Where do I put add-on vehicle files in FiveM?
Inside a resource folder in the server resources directory. The .yft and .ytd files go in a subfolder named stream. The .meta files go in any other subfolder (usually data) and are declared in fxmanifest.lua.
Do players have to download or install the vehicle?
No. The server streams the resource to every player when they connect. Nothing is installed in the player's GTA V folder.
Can I put several vehicles in one resource?
Yes. Put all the model files in the same stream folder and either merge the metas or keep one set per vehicle in subfolders and declare them with a glob pattern such as data/**/vehicles.meta, which the files and data_file entries both accept.
Why does my add-on vehicle not spawn?
The most common causes are a resource that is not started, a meta file missing from files in the manifest, or a modelName that does not match the .yft file name. The troubleshooting guide lists each case with its fix.
What is the difference between __resource.lua and fxmanifest.lua?
__resource.lua is the old manifest format. FiveM documents it as deprecated and recommends fxmanifest.lua with fx_version for every resource.

Sources

Products from this guide

All guides