Starter Items

If you use qbcore, ignore this step completely since your starter items will automatically be found in qb-multicharacter. If you have any problems during these starter items using qbcore, most of the time the problem is the use of external multicharacter, since with the native qbcore assets everything will work automatically.

Quasar Inventory integrates a small system of starter items which are an edition for esx, since qbcore has them in an automated way. To add starter items we will have to apply some changes to our esx_identity, which we must already have one integrated into our server natively.

Where should I add the starter items?

In case of esx, after having completed the entire guide below, you can find the list of items within qs-inventory/server/custom/framework/esx.lua, and apply the edits you want yourself. We will leave a brief example of what the configuration looks like:

StarterItems = {
    ['id_card'] = 1,
    ['water_bottle'] = 5,
    ['tosti'] = 5,
    ['phone'] = 1,
}

In the case of qbcore we have the default items automatically in qb-multicharacter/server/main.lua and it looks like this:

local function GiveStarterItems(source)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)

    for _, v in pairs(QBCore.Shared.StarterItems) do
        local info = {}
        if v.item == "id_card" then
            info.citizenid = Player.PlayerData.citizenid
            info.firstname = Player.PlayerData.charinfo.firstname
            info.lastname = Player.PlayerData.charinfo.lastname
            info.birthdate = Player.PlayerData.charinfo.birthdate
            info.gender = Player.PlayerData.charinfo.gender
            info.nationality = Player.PlayerData.charinfo.nationality
        elseif v.item == "driver_license" then
            info.firstname = Player.PlayerData.charinfo.firstname
            info.lastname = Player.PlayerData.charinfo.lastname
            info.birthdate = Player.PlayerData.charinfo.birthdate
            info.type = "Class C Driver License"
        end
        Player.Functions.AddItem(v.item, v.amount, false, info)
    end
end

Remember that if something fails in the qbcore event it is due to the use of external multicharacters, which we cannot take responsibility for if they malfunction, we will always recommend the use of the official qbcore multicharacter.

My external multicharacter gives errors with starter items (qbcore only)

In this case, we recommend that you make use of the tickets in the community of the vendor of your multicharacter system, since it is not a problem that comes from the inventory, as we can verify using qb-multicharacter or esx_multicharacter.

My esx_identity does not have the functions mentioned below (esx only)

You may have these problems if you use a custom esx_identity, we recommend contacting the vendor of your identity system as they all contain an event when registration ends, but we cannot know what the event is on external assets.

We always maintain the use of official assets as a guide or as a simple example of integration so that others can apply the same changes.


Modifications to esx_identify

To integrate the native inventory events on starter items, we will search within our esx_identity/client/main.lua for the following callback, which we will use as a guide.

RegisterNUICallback('register', function(data, cb)

Once this callback is detected we will add our own event at the end of the personal registration, leaving something like the example below:

RegisterNUICallback('register', function(data, cb)
    if not guiEnabled then
        return
    end

    ESX.TriggerServerCallback('esx_identity:registerIdentity', function(callback)
        if not callback then
            return
        end

        ESX.ShowNotification(TranslateCap('thank_you_for_registering'))
        TriggerEvent('inventory:client:GiveStarterItems') -- Starter Items
        setGuiState(false)

        if not ESX.GetConfig().Multichar then
            TriggerEvent('esx_skin:playerRegistered')
        end
    end, data)
end)

Once all the steps are ready, we will apply the list of starting items within the inventory in qs-inventory/server/custom/framework/esx.lua, where we will have the complete list as an example by default, remember to add items that you have in your qs- inventory/shared/items.lua.


File with the integration applied

Once we know the steps previously applied, we will leave here the latest stable version of esx_identity provided by the official esx_core but with the modification of starter items added.

In case you have any errors using it, make sure you have everything sorted accordingly in server.cfg and use a modern legacy esx build.

Last updated