Can someone clarify vehicle_names.lua hash question for me?

Hi there guys,

I’ve read quite a few tutorials that mention vehicle_names.lua, the hashes within and their importance for mod shops that use hashes but I’ve got a quick question about what actually needs to get hashed.

What needs to get hashed?

I’ve packaged a couple hundred resources and I’ve seen car make, car make and car model, modifications, website names and urls, shoutouts… Pretty much, if it fits in the file, someone has likely hashed it.

So what needs to be in there for it to serve it’s purpose? Just the car make and model? Does anything having to do with the mods need to be listed?

Thanks for your time!

Not sure about ‘mod shops’ that need hashes. but for vehicle names use this:

Citizen.CreateThread(function()
    AddTextEntry("vehicle spawn/model name", "display name you want")
end)

note that there’s no hashes in this, it’s just using the vehicle’s model name.

For hashes, use this instead:

Citizen.CreateThread(function()
    AddTextEntryByHash(<hash>, "text")
end)
1 Like

Hi there Vespura and thanks for the help!

Unfortunately, I’m even more confused now than before. You explain that either a text entry with no hash or a hashed entry would get added when this tutorial clearly shows hashes being used in the text entry

Citizen.CreateThread(function()
	-- Nissan GTR
	AddTextEntry('0x9F05F101', 'gtr17')
	-- Range Rover
	AddTextEntry('0x9F05F109', 'rsvr16')
end)

Is the first entry the hashed name and the second the spawn name? That’s backwards to your format.

Any clarification would be greatly appreciated!

That tutorial is wrong, according to the elements, this is the intended use:

So for hashes, use it like this:

Citizen.CreateThread(function()
	-- Nissan GTR
	AddTextEntryByHash(0xFA395577, 'gtr17')
end)

The code above will show “gtr17” in the bottom right when you enter the car.
If you want it to show “Nissan GTR” then use this:

Citizen.CreateThread(function()
	-- Nissan GTR
	AddTextEntryByHash(0xFA395577, 'Nissan GTR')
end)

The hash of course being the model name joaat hash. This hash you provided (0x9F05F101) is not the correct hash.
for gtr17 this would be 0xFA395577

So I can put anything there in the right for spawn name and just generate the hash for it?

AddTextEntryByHash(0x62153B72, 'Schwims car')

which leads me to a follow-up question. When I’m packaging multiple vehicles into a single resource, how would the server know which line belongs to which car? Do I have to place that hash somewhere in one of the metas?

if that hash matches the joaat hash of your vehicle model, then yes.

no, the easiest way to do all this is go into the vehicles.meta file, and for each vehicle make sure the “gameName” is set to the model name, not to some custom name.
Then in a client script (vehicle_names.lua or call it whatever you want), do this:

Citizen.CreateThread(function()
    AddTextEntry("vehicle spawn/model name", "display name you want")
end)

that way you don’t even need to worry about hashes. As long as the "vehicle spawn/model name" you put in the function, is the same as the gameName entry in vehicles.meta, it will work.

1 Like

I think I understand now. The left represents the spawn/model name and the right is the human readable entry for display in game.

Secondly, I don’t need to use the hash at all, I can simply add the text entry of the model/spawn name as long as it matches gameName.

I can’t thank you enough for your help. I can’t believe how badly the tutorials I’ve read have botched this.

3 Likes

That’s why I hope more official docs (docs.fivem.net) will be added/updated soon. But time will tell.

4 Likes

Hi there Vespura, I’ve got a related question and it concerns your vMenu. Since it’s not a bug but rather a mistake I’m making, I didn’t want to put it in your thread.

I went through every car resource and created vehicle_names.lua (called as a client resource by resource.lua) and the entirety of that file looks like this:

Citizen.CreateThread(function()

	AddTextEntry('dodgesrt2', 'SRT-10 Drag')
	
end)

But if I spawn this vehicle then save it in vMenu. When I look at saved vehicles, it shows my saved name on the left and (NULL) on the right for modelName.

What am I doing wrong that vMenu doesn’t register the modelName?

uhm potentially your gameName or some other value in the vehicles.meta isn’t the model name?

The game name and modelname are not the same:

<modelName>jp12</modelName>
      <txdName>jp12</txdName>
      <handlingId>jp12</handlingId>
      <gameName>Wrangler</gameName>

Should the vehicles_name only include the gameName and not spawnby modelName?

the spawn name of that vehicle is jp12 right? set the gameName to jp12 and change that in your vehiclenames script as well.

Ok, so to clarify, in each addon car resource, I should make vehicle_names entry, modelName and gameName represent what the car is spawned by (in this case, jp12)?

Citizen.CreateThread(function()

	AddTextEntry('jp12', 'Rubicon')
	
end)

well, the gameName should be whatever you put in the modelName or txdName fields i think. I’m not exactly sure what the ‘requirements’ are, but i always just keep them the same (like they usually already are from the vehicle.meta you got from the download). and that always seems to work for me.

only thing you should probably ever change is the gameName though, so just make sure that matches the other fields.

How i can add this and where:

For no reason that I know, some cars duplicate the Name
Like:
" Mercedes S500 2021 Mercedes S500 2021 "

Sounds like you’re putting the same value for <gameName> and <vehicleMakeName>.

<vehicleMakeName> should be the make/brand of the vehicle, or just simply <vehicleMakeName /> if you don’t want to have the brand show up. You’ll want to add a text entry for this as well if you do give it a value.

Here’s an example:

	<modelName>maj350z</modelName>
	<txdName>maj350z</txdName>
	<handlingId>maj350z</handlingId>
	<gameName>Z33</gameName>
	<vehicleMakeName>NISSAN</vehicleMakeName>
Citizen.CreateThread(function()
	AddTextEntry('NISSAN', 'Nissan')
	AddTextEntry('Z33', '350z')
end)

@Vespura Should vMenu be using the text entries for vehicle mod parts, for example bumpers, spoilers, skirts, etc?

Here’s a partial example I got from a .gxt2 file within a single player mod I’m trying to convert for FiveM.

	AddTextEntryByHash(0x00645B96, 'Low Tuning Bumper')
	AddTextEntryByHash(0x038DA885, 'Carbon GT Wing')
	AddTextEntryByHash(0x0EF7FD33, 'Quad Tuner Exhaust')
	AddTextEntryByHash(0x1CFB8C8C, 'Performance Hood')