Resources & Server Setup

What are a spawn name and a model hash?

A spawn name is the model name of a vehicle, the word you type after a spawn command such as /car adder. It is set by the modelName tag in vehicles.meta and must match the file name of the .yft model. A model hash is the 32-bit number the game uses internally in place of that name, calculated from the lowercase name with the Jenkins one-at-a-time (joaat) hash. Scripts can use either form, because FiveM converts a name to its hash with GetHashKey.

Where the spawn name comes from

For an add-on vehicle the spawn name is whatever the <modelName> tag says in vehicles.meta. For a replace vehicle it is the name of the stock car being replaced. The name is not the name of the resource folder, not the title of the mod on gta5-mods.com and not the display name shown on the HUD.

ThingExampleSet by
Spawn name (model name)mycar<modelName> in vehicles.meta and the .yft file name
Display nameMy Car GTA text label registered for the <gameName> key
Resource namemycar-packThe folder name used with ensure
Model hashA 32-bit numberCalculated from the spawn name

Looking for a base game spawn name or hash? Vehicle Spawn Codes is a searchable list. Open the Vehicle Spawn Codes

How the hash is calculated

The engine does not store model names as text. It stores the Jenkins one-at-a-time hash of the lowercase name, usually written joaat. Because the name is lowercased first, Adder, ADDER and adder all give the same hash.

The same value can be displayed in three ways, which often causes confusion when comparing lists: as an unsigned number, as a signed number (which is negative for roughly half of all names) and in hexadecimal. In FiveM Lua, GetHashKey returns the signed form.

lua
RegisterCommand('car', function(source, args)
    local name = args[1] or 'adder'
    local model = GetHashKey(name)

    if not IsModelInCdimage(model) or not IsModelAVehicle(model) then
        print('Invalid vehicle model: ' .. name)
        return
    end

    RequestModel(model)
    while not HasModelLoaded(model) do
        Wait(0)
    end

    local ped = PlayerPedId()
    local pos = GetEntityCoords(ped)
    local vehicle = CreateVehicle(model, pos.x, pos.y, pos.z, GetEntityHeading(ped), true, false)
    SetPedIntoVehicle(ped, vehicle, -1)
    SetModelAsNoLongerNeeded(model)
end, false)
Client script: spawn a vehicle by name, with a validity check

The check with IsModelInCdimage is what separates a clean error message from a script stuck waiting for a model that will never load.

Where the name has to match

One spelling has to be used consistently in several files. A mismatch in any of them breaks a different part of the car:

To rename a car, change all of these together. Keep names short, lowercase and free of spaces and special characters, and make sure no other vehicle on the server, stock or add-on, already uses the name.

Common problems

  • Invalid model: the name typed does not match <modelName>, or the resource is not started. See invalid model.
  • Spawns the wrong car: two resources use the same model name, or the name collides with a stock vehicle.
  • Cannot find the spawn name of a downloaded mod: open its vehicles.meta and read <modelName>, or look at the .yft file names in the stream folder.

For base game vehicles, the Vehicle Spawn Codes tool is a searchable list of spawn names and hashes. For a new add-on, the Vehicles.meta Generator keeps the name consistent across the files it writes.

Frequently asked questions

How do I find the spawn name of an add-on car?

Open the car's vehicles.meta and read the modelName tag. It is also the file name of the main .yft file in the stream folder, without the extension.

Is the spawn name case-sensitive?

No. The name is converted to lowercase before it is hashed, so upper and lower case give the same model. File names on a Linux server are still case-sensitive, so lowercase is the safe convention.

Why is my model hash a negative number?

The hash is a 32-bit value. Shown as a signed integer, any hash with its highest bit set appears negative. It is the same hash as the large positive number shown in unsigned form.

More in Resources & Server Setup: fxmanifest.lua, fx_version 'cerulean', data_file, stream folder, server.cfg (ensure / start)

Still need the car as a FiveM resource?

Paste a gta5-mods.com vehicle link and get a FiveM-ready resource with the manifest and metas in place. 3 free conversions, no signup.

  • 3 conversions free, no account needed
  • 2 more free if you leave an email
  • After that: $15 once for unlimited conversions and the Pro tools, no subscription