Starter items

Do not do this if you are using qb-core, as the qb-core framework has natives that do this job automatically. This event will only work when run with esx.

You can modify the Starter Items in your server/custom/framework/esx.lua.

To add the starter items we must make certain modifications in our esx_identity, or in case of using another resource, it will be the responsibility of the server owner, but with this guide you will receive help and useful information to achieve it in any type of similar system.

To do this, we will go to our esx_identity/client/main.lua and apply the following change near the end of RegisterNUICallback('register', function(data, cb), right where the welcome message to the server is, in case of using the latest versions of esx_identity, it is near the bottom of the file:

TriggerEvent('inventory:client:GiveStarterItems')

This will leave us with a result similar to the following:

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)

We also attach the previously modified file so you don't have to do it yourself, but remember that if you don't use the latest versions of esx-legacy, it probably won't work and you'll have to add it yourself manually.

Last updated