Installations

STEP 1 - Dependencies

It is important to use the dependencies that are indicated in this step, do not use others, otherwise you will receive critical errors

ESX

fivem-california-plate-text only has 1 dependency, which is `es_extended`, download it by clicking on the following buttons

QBCore

fivem-california-plate-text only has 1 dependency, which is `qb-core`, download it by clicking on the following buttons


STEP 2 - Download resource

ESX & QBCore

Download the resource or just copy only what you need.


STEP 3 - Setup files

ESX & QBCore

Configuration:

ESX path: `es_extended/config.lua`

QBCore path: `qb-core/config.lua`

Config.CustomAIPlates = print(plate) -- Custom plates for AI vehicles (server/modules/plate.lua)

Script:

ESX path: `es_extended/server/modules/*plate.lua`

QBCore path: `qb-core/server/*plate.lua`

*(to be created)

local letters = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}

local plate = ""
local numLetters = math.random(1, 3)
for i=1,numLetters do
    local letterIndex = math.random(1, #letters)
    plate = plate .. letters[letterIndex]
end

local numDigits = math.random(1, 5)
for i=1,numDigits do
    local digit = tostring(math.random(0, 9))
    plate = plate .. digit
end

-- Shuffle the plate string randomly
local plateTable = {}
for i=1,#plate do
    table.insert(plateTable, plate:sub(i, i))
end
for i=#plateTable,2,-1 do
    local j = math.random(i)
    plateTable[i], plateTable[j] = plateTable[j], plateTable[i]
end

plate = table.concat(plateTable)

-- Add leading zeros if necessary
if #plate < 7 then
    plate = string.rep("0", 7-#plate) .. plate
end

-- print(plate)

QBCore

You need to add this native with the above script

SetDefaultVehicleNumberPlateTextPattern(-1, Config.CustomAIPlates)

Dernière mise à jour