vehicles.meta explained, field by field

By Nilo3D · Updated:

vehicles.meta is the XML file that registers a vehicle model with GTA V. Each Item names the model and its texture dictionary, links it to a handling entry and a seat layout, and sets its type, class, LOD distances and behaviour flags. Without an entry here the game does not treat a .yft as a vehicle.

What does vehicles.meta do?

vehicles.meta holds one <Item> per vehicle inside <InitDatas>. When the file is loaded, the game creates a vehicle model for each Item and resolves the things it points at: the handling entry, the layout, the cameras and the explosion info. On FiveM it is loaded with data_file 'VEHICLE_METADATA_FILE'.

The tag names below come from the game's own data schema, so they are exact. A typical add-on entry starts as a copy of the stock vehicle that is closest to it, with the identity fields changed.

<?xml version="1.0" encoding="UTF-8"?>
<CVehicleModelInfo__InitDataList>
  <residentTxd>vehshare</residentTxd>
  <residentAnims />
  <InitDatas>
    <Item>
      <modelName>mycar</modelName>
      <txdName>mycar</txdName>
      <handlingId>MYCAR</handlingId>
      <gameName>MYCAR</gameName>
      <vehicleMakeName>KARIN</vehicleMakeName>
      <audioNameHash>sultan</audioNameHash>
      <layout>LAYOUT_STANDARD</layout>
      <cameraName>DEFAULT_FOLLOW_VEHICLE_CAMERA</cameraName>
      <wheelScale value="0.293000" />
      <wheelScaleRear value="0.293000" />
      <HDTextureDist value="5.000000" />
      <lodDistances content="float_array">
        10.000000
        25.000000
        50.000000
        100.000000
        500.000000
        500.000000
      </lodDistances>
      <flags>FLAG_AVERAGE_CAR FLAG_POOR_CAR</flags>
      <type>VEHICLE_TYPE_CAR</type>
      <plateType>VPT_BACK_PLATES</plateType>
      <dashboardType>VDT_SULTAN</dashboardType>
      <vehicleClass>VC_SPORT</vehicleClass>
      <wheelType>VWT_SPORT</wheelType>
      <!-- copy the remaining tags from the stock vehicle you start from -->
    </Item>
  </InitDatas>
  <txdRelationships>
    <Item>
      <parent>vehshare</parent>
      <child>mycar</child>
    </Item>
  </txdRelationships>
</CVehicleModelInfo__InitDataList>

Which fields identify the vehicle?

Five fields tie the entry to the model files and to the other metas, and each one has to match its counterpart exactly.

FieldMeaningMust match
modelNameModel file name and spawn name.stream/<modelName>.yft
txdNameTexture dictionary file name.stream/<txdName>.ytd
handlingIdName of the handling entry to use.handlingName in handling.meta
gameNameText label key for the display name. Stored in a 12-character buffer, so keep it to 11 characters or fewer.A label added with AddTextEntry
vehicleMakeNameText label key for the manufacturer. Same length limit.Optional label

handlingId can point at a stock handling entry such as SULTAN. In that case the vehicle needs no handling.meta of its own.

Which fields control seats, cameras and sound?

These fields pick ready-made setups by name. The names refer to entries that already exist in the game, or to ones you add in another meta file.

FieldSchema defaultMeaning
layoutLAYOUT_STANDARDSeat layout from vehiclelayouts.meta: seats, entry points and animations. See vehiclelayouts.meta explained.
audioNameHashemptyName of the audio setup to use, normally the model name of a stock vehicle.
cameraNameDEFAULT_FOLLOW_VEHICLE_CAMERAThird-person follow camera.
aimCameraNameDEFAULT_THIRD_PERSON_VEHICLE_AIM_CAMERACamera used while aiming from the vehicle.
bonnetCameraName, povCameraNameemptyBonnet and first-person cameras.
coverBoundOffsetsSTANDARD_COVER_OFFSET_INFOCover positions around the vehicle.
explosionInfoEXPLOSION_INFO_DEFAULTWhich explosion setup is used when the vehicle blows up.
vfxInfoNameVFXVEHICLEINFO_CAR_GENERICVisual effects set (exhaust, wheel effects).
numSeatsOverride-1Forces the seat count; -1 leaves it to the layout.

What do lodDistances and HDTextureDist mean?

lodDistances is a list of six distances in metres that decide which version of the model is drawn. The first value is the range of the high-detail model; when it is greater than zero the game also registers a second model file named <modelName>_hi.

PositionInternal nameModel version drawn up to this distance
1VLT_HDHigh-detail model (_hi.yft).
2VLT_LOD0Highest LOD inside the main .yft.
3VLT_LOD1Second LOD.
4VLT_LOD2Third LOD.
5VLT_LOD3Fourth LOD.
6VLT_LOD_FADEThe vehicle stops being drawn. If this is 0 the game uses the fifth value.

The stock Sultan uses 10, 25, 50, 100, 500, 500. HDTextureDist (default 5.0) is the distance for high-resolution textures. LODs themselves are explained in what are LODs in FiveM vehicles.

Other rendering fields: wheelScale and wheelScaleRear set the front and rear wheel scale, dirtLevelMin and dirtLevelMax (0 to 1) set how dirty the vehicle spawns, diffuseTint is a color tint, and damageMapScale and damageOffsetScale (0 to 1) limit visual deformation.

How the six distances map to the LOD levels of the model, with the values we use, is in how to optimise a FiveM vehicle.

What are the valid values for type, vehicleClass and the other enums?

Five fields each take one value from a fixed list. Anything off the list is invalid.

FieldValues
typeVEHICLE_TYPE_CAR, _PLANE, _TRAILER, _QUADBIKE, _DRAFT, _SUBMARINECAR, _AMPHIBIOUS_AUTOMOBILE, _AMPHIBIOUS_QUADBIKE, _HELI, _BLIMP, _AUTOGYRO, _BIKE, _BICYCLE, _BOAT, _TRAIN, _SUBMARINE
vehicleClassVC_COMPACT (0), VC_SEDAN, VC_SUV, VC_COUPE, VC_MUSCLE, VC_SPORT_CLASSIC, VC_SPORT, VC_SUPER, VC_MOTORCYCLE, VC_OFF_ROAD, VC_INDUSTRIAL, VC_UTILITY, VC_VAN, VC_CYCLE, VC_BOAT, VC_HELICOPTER, VC_PLANE, VC_SERVICE, VC_EMERGENCY, VC_MILITARY, VC_COMMERCIAL, VC_RAIL, VC_OPEN_WHEEL (22)
plateTypeVPT_FRONT_AND_BACK_PLATES, VPT_FRONT_PLATES, VPT_BACK_PLATES, VPT_NONE
wheelTypeVWT_SPORT, VWT_MUSCLE, VWT_LOWRIDER, VWT_SUV, VWT_OFFROAD, VWT_TUNER, VWT_BIKE, VWT_HIEND, VWT_SUPERMOD1 to VWT_SUPERMOD5
dashboardTypeVDT_BANSHEE, VDT_BOBCAT, VDT_CAVALCADE, VDT_COMET, VDT_DUKES, VDT_FACTION, VDT_FELTZER, VDT_FEROCI, VDT_FUTO, VDT_GENTAXI, VDT_MAVERICK, VDT_PEYOTE, VDT_RUINER, VDT_SPEEDO, VDT_SULTAN, VDT_SUPERGT, VDT_TAILGATER, VDT_TRUCK, VDT_TRUCKDIGI, VDT_INFERNUS, VDT_ZTYPE, VDT_LAZER, VDT_SPORTBK, VDT_RACE, VDT_LAZER_VINTAGE, VDT_PBUS2

type has to agree with the handling: a VEHICLE_TYPE_BIKE needs a handling entry with a bike sub-handling block, a car needs a car block. wheelType decides which wheel category the tuning menu offers.

What do the flags in vehicles.meta do?

<flags> is a space-separated list of names. Each name switches one behaviour on. The schema defines about 200 of them. The table has the ones add-on authors touch most, with the description from the game data.

FlagEffect
FLAG_HAS_LIVERYThe vehicle has liveries; a texture is swapped when it spawns.
FLAG_EXTRAS_ALLAll suitable extras are turned on.
FLAG_EXTRAS_REQUIREOne of the available extras must be picked.
FLAG_EXTRAS_STRONGExtras do not break off.
FLAG_IS_ELECTRICThe vehicle has no petrol tank.
FLAG_NO_BOOTThe vehicle is not considered for boot inventory.
FLAG_IS_VANVan: the rear doors open sideways.
FLAG_LAW_ENFORCEMENT, FLAG_EMERGENCY_SERVICEMarks police and emergency vehicles.
FLAG_NO_RESPRAYCannot be resprayed at garages.
FLAG_CANNOT_BE_MODDEDStops the vehicle from being modded.
FLAG_DONT_SPAWN_AS_AMBIENT, FLAG_DONT_SPAWN_IN_CARGENKeeps the vehicle out of ambient traffic and out of parked-car generators.
FLAG_DRIVER_NO_DRIVE_BYThe driver cannot do drive-bys.
FLAG_HAS_BULLETPROOF_GLASSThe glass cannot be smashed.
FLAG_RICH_CAR, FLAG_AVERAGE_CAR, FLAG_POOR_CARWhich kinds of peds can be used as drivers.
FLAG_HEADLIGHTS_USE_ACTUAL_BONE_POSHeadlights use the real bone position.

Which fields affect traffic and spawning?

A group of fields only matters when the game itself spawns the vehicle in traffic. On most roleplay servers add-on vehicles are spawned by scripts, so these can stay at the values of the stock vehicle you copied.

  • frequency and maxNum: how often and how many can exist in ambient traffic.
  • swankness: SWANKNESS_0 to SWANKNESS_5, from run-down to very nice.
  • identicalModelSpawnDistance and maxNumOfSameColor (default 10): keep identical vehicles from clustering.
  • defaultBodyHealth: default 1000.
  • trailers, drivers, extraIncludes, requiredExtras: lists for trailers that can attach, forced driver models and extras that spawn together.

What are residentTxd and txdRelationships?

residentTxd, at the top of the file, names a texture dictionary that stays loaded for the vehicles in the file. Stock files use vehshare, the shared vehicle textures. txdRelationships, at the bottom, is a list of parent and child pairs: when a texture is not found in the child dictionary the game looks in the parent.

That is how a vehicle whose .ytd does not contain the common textures still finds them in vehshare, and how several vehicles can share one custom dictionary: make it the parent of each vehicle's txdName.

Frequently asked questions

Where is vehicles.meta located in GTA 5?
The base file is in common.rpf at data/levels/gta5/vehicles.meta, and each DLC pack has its own under common/data/levels/gta5/. On FiveM an add-on vehicle ships its own vehicles.meta inside the resource.
What is the spawn name of an add-on vehicle?
The spawn name is the modelName field in vehicles.meta, which is also the file name of the .yft model. gameName is only the display label.
How long can gameName be?
The game stores gameName and vehicleMakeName in 12-character buffers, so each can be at most 11 characters.
Can two vehicles share one handling entry?
Yes. Several vehicles.meta entries can use the same handlingId. They will drive identically.
How do I load vehicles.meta in FiveM?
List the file under files in fxmanifest.lua and add data_file 'VEHICLE_METADATA_FILE' with the same path.

Sources

Products from this guide

All guides