This resource was created for ESX servers to easily and automatically add display names to vehicles from their database

Features:

  • Supports ESX

  • Automatically adds display names to vehicles within SQL database

  • Automatically detects framework with no need of additional configuration

  • Option to add additional vehicles within the config

Installation

Known Issues

  • Some labels will not show up properly. This is not a malfunction of the script and seems to be a bug with textures of certain vehicles apparently(Not really sure).

Credits

Download

My Other Releases:

Code is accessible Yes
Subscription-based No
Lines (approximately) ~80
Requirements es_extended(ESX)
Support Yes
Download GitHub

Seems bit overkill for something that can be done with one lua file.

1 Like

I was not aware that you could pull from SQL without a server-side to script.

Please, enlighten me :slight_smile:

You don’t need to do any SQL queries.

function AddTextEntry(key, value)
	Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"), key, value)
end
Citizen.CreateThread(function()

    AddTextEntry('c63vip', 'C63 AMG Vip')
    
end)

The above gives the same result.

If you wanted to add them manually I suppose that would work. I made this so I didn’t have to manually add them all by hand.

I have 400+ vehicles and personally found it much faster to do it this way.

Btw, you don’t need this portion of your code:

function AddTextEntry(key, value)
	Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"), key, value)
end

Completely pointless as it’s already a FiveM native lol.

I’m at a loss as to what table you’re referring to that stores vehicles? I’m using QB and the only vehicle table i have is the player_vehicles, which is the vehicles already purchased, but in order to be purchased they need manually adding ti the vehicles.lua anyway which handles the display name?

1 Like

Oh crap. I see what you’re saying now. My apologies.

I have never really used QBCore so I may have set that side up more on assumption.

Where are vehicle shop vehicles stores? (For the vehicle dealership for example)

I used for ESX, which stores most vehicles under a vehicles sql table which I queried the data from to set the text entries.

Added QBCore at the very end but had no one to help reference it.

I went and downloaded qb-vehicleshop and now see that this doesn’t really work for QBCore because vehicles are saved in Lua tables within the config.

Will update when I return to computer. Suppose this will only benefit ESX users.

haha not to worry, seems we we’re confusing each other.

For each custom vehicle to be added to the dealership in QBCore this needs adding to the vehicles.lua which can be found in
QB-core/shared

--Custom Vehicles--
	['c63vip'] = {
		['name'] = 'C63 VIP',
		['brand'] = 'Mercedes',
		['model'] = 'c63vip',
		['price'] = 99999999,
		['category'] = 'coupes',
		['hash'] = 'c63vip',
		['shop'] = 'pdm'
	}

From my findings, if the vehicle isn’t in the shop, it can’t be saved to the DB, even when using the admin command (I may be wrong on this)

As you can see the above handles display name and brand.

This is the result of that.

Yes the confusion was because of my lack of knowledge of QBCore; my apologies again.

But you still have to have your own AddTextEntry thread in order to achieve the vehicle label to be set?

I really need to just set up a qb test server.

Going to take a closer look and see if I can’t still add support for QBCore (without sql queries obviously) but maybe automatically add text entries to vehicles within the framework’s vehicles.lua. I’ll have to see when I am not on phone.

EDIT: I see, this is already done by QBCore, this is only useful for ESX.

No no, no need to apologise, we all learn from each other at the end of the day.

The AddTextEntry isn’t required, it’s obsolete, that original snippet i posted was from an ESX server i had a few year back, It would be needed for vehicles not in the vehicle.lua, but then you won’t be able to store them or purchase anyway.

Only thing needed for the label to be set is all done in vehicles.lua for QBCore.

I appreciate you.

Although this is completely useless to you as well as other QBCore users as this feature is already enabled within your framework. I think this could still be of some use for some major time saving amongst ESX users at least.

I’ve updated my post & github accordingly.



Looking for paid scripts? Click here