I will make a simple tutorial today
I did just this , and The resource loads but the vehicles still say Null in the garage? No errors but they just still say null
would you be able to show what the resource.lua file should have in it…i put a blank one and it didnt load…am i missing what you mean as I think I create the veh.lua then put it in a folder with a resource lua the start the resource and it should work?
Stop using old methods to grab vehicle names.
Using addtextentry
Grab the vehicle name,model,cat from vehicles database table (make one if you dont have) and stored it in server as a table.
Send it to client and use that on the garage script.
This way it will much customizable you can even make it categorized.
Im sorta following you here…could you show a demo or pics of what you mean as im not sure what you mean by addtextentry…and they are in the data base but all show NULL…im a noob trying to learn so any help would be sweet as I feel im a quick learner
It worked for me, I changed it inside the resource another example
Ej:
Inside __resource.lua
fx_version ‘adamant’
game ‘gta5’
description ‘CarNames’
version ‘1.0.0’
client_scripts {
‘client.lua’,
}
within the client.lua Ej:
Citizen.CreateThread(function()
AddTextEntry(‘308cc’, ‘Peugeout 308’)
AddTextEntry(‘p207’, ‘Peogeout 207’)
AddTextEntry(‘sjmi16’, ‘Preogeout 405’)
AddTextEntry(‘fiat’, ‘Fiat 147’)
AddTextEntry(‘ford’, ‘Ford Focus’)
AddTextEntry(‘greenbird’, ‘Micro Doble’)
AddTextEntry(‘xkgt’, ‘Jagguar’)
AddTextEntry(‘punto’, ‘Fiat Punto’)
end)
Found new resource vehicles_names in C:/txData\PlumeXXXXXX.base/resources//[cars]/[paratrabajos]/vehicles_names
Started resource vehicles_names
still [ citizen-server-impl] Couldn’t find resource veh_label.
you need to put like this in __resource.lua
client_scripts {
'client.lua',
}
after that , it will work
Get vehicles names names from vheicles names file is very old, you can make an evento to get vehicle name from databse.
In server.lua
elseif type == 'cars' then
local ownedCars = {}
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND category = @category', {
['@owner'] = xPlayer.identifier,
['@Type'] = 'cars',
['@job'] = 'unemployed',
['@category'] = 'cars'
}, function(data)
for _,v in pairs(data) do
local vehicle = json.decode(v.vehicle)
table.insert(ownedCars, {vehicle = vehicle, plate = v.plate, vehName = v.name, fuel = v.fuel, stored = v.stored})
end
cb(ownedCars)
end)
end
in client.lua
elseif action == 'cars' then
local elements = {head = {_U('veh_plate'), _U('veh_name'), _U('veh_loc'), _U('actions')}, rows = {}}
ESX.TriggerServerCallback('esx_advancedgarage:getOwnedVehicles', function(ownedCars)
for _,v in pairs(ownedCars) do
local vehStored = _U('veh_loc_unknown')
if v.stored then
vehStored = _U('veh_loc_garage')
else
vehStored = _U('veh_loc_impound')
end
table.insert(elements.rows, {data = v, cols = {v.plate, v.vehName, vehStored, '{{' .. _U('spawn') .. '|spawn}} {{' .. _U('rename') .. '|rename}}'}})
end
ESX.UI.Menu.Open('list', GetCurrentResourceName(), 'owned_vehicles_list', elements, function(data2, menu2)
local vehVehicle, vehPlate, vehStored, vehFuel = data2.data.vehicle, data2.data.plate, data2.data.stored, data2.data.fuel
if data2.value == 'spawn' then
if vehStored then
SpawnVehicle(vehVehicle, vehPlate, vehFuel)
ESX.UI.Menu.CloseAll()
else
ESX.ShowNotification(_U('veh_not_here'))
end
elseif data2.value == 'rename' then
if Config.Main.RenameVehs then
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'renamevehicle', {
title = _U('veh_rename', Config.Main.RenameMin, Config.Main.RenameMax - 1)
}, function(data3, menu3)
if string.len(data3.value) >= Config.Main.RenameMin and string.len(data3.value) < Config.Main.RenameMax then
TriggerServerEvent('esx_advancedgarage:renameVehicle', vehPlate, data3.value)
ESX.UI.Menu.CloseAll()
else
ESX.ShowNotification(_U('veh_rename_empty', Config.Main.RenameMin, Config.Main.RenameMax - 1))
end
end, function(data3, menu3)
menu3.close()
end)
else
ESX.ShowNotification(_U('veh_rename_no'))
end
end
end, function(data2, menu2)
menu2.close()
end)
end, 'unemployed', 'cars')
end
end, function(data, menu)
menu.close()
end)
end
end
Call me in discord i send to you full script
Gaspar#0880
can i have someones help with esx drp garage not
showing my car names in the garages all the regular gta5 car show but not the newer cars i add
you should have the vehicle_name.meta for show name .otherwise it shows null in esx_drp_garage
i see what you saying but there is nothing in the vehicle meta showing garage car names or indicating null to change with actual vehicle name any way to show example
Hope this helps I found a fix
Make sure GameName is under 11 characters otherwise the vehicle will display as NULL in store.
You can set gamename to what you want
So
“ANY NAME UNDER 11 CHARACTERS HERE”
Then make sure you have a file vehicle_names.lua in the resource folder with the following contents:
Citizen.CreateThread(function()
AddTextEntry(‘GAMENAME HERE’, ‘CUSTOM INGAME NAME HERE’)
end)
Add the following into the fxmanifest.lua:
client_scripts {
‘vehicle_names.lua’
}
If you do not have a manifest.fx create one:
fx_version ‘adamant’
game ‘gta5’
client_scripts {
‘vehicle_names.lua’
}
For fix null you have to do this things.
-
Go to add on car folder and open vehicles.meta file
-
in this file make sure:
have the same spawnname -
Create a folder in resources.
-
name the folder vehicle_names, open it and create 2 file: __resource.lua and client.lua
-
in __resource.lua paste: client_script “client.lua”
-
in client.lua paste:
Citizen.CreateThread(function()
AddTextEntry(‘spawnname’, ‘nameinshoporgarage’)
end)
- then put in server.cfg:
start yourcar
start vehicle_names
start garage or shop or what you want
ps: Change the " in __resource.lua and in client.lua with your "
my car names aren’t switching
el nombre que le pongas al auto en el client tiene que ser el mismo que el que se usa en la base de datos de mysql.
I know its been 3 years but what do i need to put in __resource.lua?
use fxmanifest.lua and not __resource.lua
then put inside
fx_version 'bodacious'
game 'gta5'
client_scripts {
'client.lua'
}
help i doesnt work