PlayerID in HUD script

Hi all,
Does anyone know how I can bring another id from the database instead of this one?

Config.PlayerServerId = function()
    return GetPlayerServerId(PlayerId())
end

I tried something like that, but I’m a beginner.
I took this from another script that displays what I want and tried to adapt it for what I need, but it didn’t turn out well.
If you can help me, please.

Config.PlayerServerId = function()
    local xPlayer = ESX.GetPlayerFromId(source)
    print(xPlayer.identifier)

    MySQL.Async.fetchAll('SELECT * FROM cnp WHERE identifier = @identifier', {
     ['@identifier'] = xPlayer.identifier,
    }, function(result)
        result.character_id
    end)
end

You can try and use State Bags, see this article for some details on how they work

maybe i don’t understand the question right now but why do you want to take the id from the database when you can just take source the source = id

because the ID is dynamic and I want to “trick” this system a bit.