By default, the license is applied to the database (both on ESX and QB). If what you want is to perform a license delivery as an item you must take into account if the license is simply an item that you have created in your core. For example, something like: "boat_license", "yacht_license". Or if it is managed by a license script.
ITEMS CREATED IN THE CORE
If you have created the item from the core, as if it were any other type of item and your core allows you to have metadata in the items you can do the following assuming that you have the items indicated above
In line 362 of config.lua you have an open function called "applyLicense" in which you can edit what happens when a user successfully completes the practical test.
In this example we will use the QB version to add an item to the user, according to the test he has performed.
We will use the following code to deliver the item with the metadata of the name and citizenid. This way each license delivered will be unique:
local info = {}info.playerName = xPlayer.PlayerData.charinfo.firstname ..' ' .. xPlayer.PlayerData.charinfo.lastnameinfo.citizenid = xPlayer.PlayerData.citizenidxPlayer.Functions.AddItem('helicopter_license', 1, nil, info)
If instead of creating the license items manually, you are using a license script it may be easier to adapt the code. You will have to check the documentation of your license script but usually you will be given an export or trigger that you can run in any function.
Imagine that we have this trigger obtained from the licensing script documentation:
As a third option, although we do not recommend it. It is possible to deliver licenses if your licensing script allows you to deliver a license to a user by command.
For example, if the script has the command /addlicense ID Type