ESX_vehicleshop Police and Ambulance Own Plates

Is it Possible , when i buy a Policecar or Ambulance Vehicle the Plate automatically generate “LSPD-XXXX” and “LSMS-XXXX” but Zivilians have “WWWW-XXXX” (X=Numbers W=Letter)?

Yes, Native Reference - Cfx.re Docs

2022 Edit: SetVehicleNumberPlateText - Natives @ Cfx.re Docs

ok but how i can add it into the vehshop? whitch line or call over esx_policejob?

I’m not too familiar with esx, but try replacing line 492 in main.lua in esx_policejob with this:

local newPlate = "whatever you want the plate to say"
1 Like

Its Line 407 to 433 so where?

ESX.RegisterServerCallback('esx_policejob:buyJobVehicle', function(source, cb, vehicleProps, type)
	local xPlayer = ESX.GetPlayerFromId(source)
	local price = getPriceFromHash(vehicleProps.model, xPlayer.job.grade_name, type)

	-- vehicle model not found
	if price == 0 then
		print(('esx_policejob: %s attempted to exploit the shop! (invalid vehicle model)'):format(xPlayer.identifier))
		cb(false)
	else
		if xPlayer.getMoney() >= price then
			xPlayer.removeMoney(price)

			MySQL.Async.execute('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, `stored`) VALUES (@owner, @vehicle, @plate, @type, @job, @stored)', {
				['@owner'] = xPlayer.identifier,
				['@vehicle'] = json.encode(vehicleProps),
				['@plate'] = vehicleProps.plate,
				['@type'] = type,
				['@job'] = xPlayer.job.name,
				['@stored'] = true
			}, function (rowsChanged)
				cb(true)
			end)
		else
			cb(false)
		end
	end
end)

Your code is different from the code on Github, are you running the most up-to-date version of the resource?

Yes but i have more than 40 Ranks in the Policejob so everythink is not at standard lines
every uniform has his own call

data.current.value == 'boss_wear' or

thats what i mean

This looks like the server script, are you sure you are looking in the client script?

ohh no :o
Line 454 to 500 in client is this

ESX.TriggerServerCallback('esx_policejob:storeNearbyVehicle', function(storeSuccess, foundNum)
		if storeSuccess then
			local vehicleId = vehiclePlates[foundNum]
			local attempts = 0
			ESX.Game.DeleteVehicle(vehicleId.vehicle)
			IsBusy = true

			Citizen.CreateThread(function()
				BeginTextCommandBusyString('STRING')
				AddTextComponentSubstringPlayerName(_U('garage_storing'))
				EndTextCommandBusyString(4)

				while IsBusy do
					Citizen.Wait(100)
				end

				RemoveLoadingPrompt()
			end)

			-- Workaround for vehicle not deleting when other players are near it.
			while DoesEntityExist(vehicleId.vehicle) do
				Citizen.Wait(500)
				attempts = attempts + 1

				-- Give up
				if attempts > 30 then
					break
				end

				vehicles = ESX.Game.GetVehiclesInArea(playerCoords, 30.0)
				if #vehicles > 0 then
					for k,v in ipairs(vehicles) do
						if ESX.Math.Trim(GetVehicleNumberPlateText(v)) == vehicleId.plate then
							ESX.Game.DeleteVehicle(v)
							break
						end
					end
				end
			end

			IsBusy = false
			ESX.ShowNotification(_U('garage_has_stored'))
		else
			ESX.ShowNotification(_U('garage_has_notstored'))
		end
	end, vehiclePlates)
end

Now that you’re in the correct file, search for esx_policejob:buyJobVehicle, and you should find the correct section of the code :stuck_out_tongue:

local newPlate = "LSPD" and exports['esx_vehicleshop']:GeneratePlate()

right?

No, just:

then i have databank problems?

Char1:11000010ac2144c 1 CQI 917 {“modExhaust”:-1,“modArchCover”:-1,“bodyHealth”:10… helicopter police 0

owner state plate vehicle type job stored

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.