Custom Prefix und Job Vehicles

Hey i will do for my Server for the Police on the Licenseplate a Prefix Like This

LAPD 1215 (Random Number)

Can Anyone Help me iam using ESX 1.1

esx_policejob

You can do that like this;

local num = math.random(0, 9)..math.random(0, 9)..math.random(0, 9)..math.random(0, 9)
SetVehicleNumberPlateText(vehicle, "LAPD"..num)

In this example, vehicle is the vehicle entity.
This will go in esx_policejob where the vehicle is being spawned by the police garage.

You should have something like this, in client/main.lua;

ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle)
	ESX.Game.SetVehicleProperties(vehicle, data2.current.vehicleProps)
	TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.vehicleProps.plate, false)
	ESX.ShowNotification(_U('garage_released'))
end)

Edit it to make it like this;

ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle)
	local num = math.random(0, 9)..math.random(0, 9)..math.random(0, 9)..math.random(0, 9)
	ESX.Game.SetVehicleProperties(vehicle, data2.current.vehicleProps)
	SetVehicleNumberPlateText(vehicle, "LAPD"..num)
	TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.vehicleProps.plate, false)
	ESX.ShowNotification(_U('garage_released'))
end)
1 Like