Id like this for qbcore if possibly.
i tried to convert but not sure im correct.
Hopefully you can review and include a config to choose what framework.

CLIENT LUA

local QBCore = exports['qb-core']:GetCoreObject() -- Assuming you have QBcore's shared object system in place

QBCore.Functions.CreateCallback('prp:isPlayerLoaded', function(source, cb)
    local player = QBCore.Functions.GetPlayer(source)
    cb(player ~= nil and player.PlayerData ~= nil)
end)

RegisterNetEvent('prp:perm')
AddEventHandler('prp:perm', function()
    QBCore.Functions.TriggerCallback('prp:isPlayerLoaded', function(isPlayerLoaded)
        if isPlayerLoaded then
            TriggerServerEvent('prp:perm')
        else
            QBCore.Functions.Notify("Wait until you're fully loaded.", 'error')
        end
    end)
end)


SERVER LUA
local QBCore = exports['qb-core']:GetCoreObject()

QBCore.Functions.CreateUseableItem('deathpill', function(source)
    TriggerClientEvent('prp:perm', source)
end)

RegisterServerEvent('prp:perm')
AddEventHandler('prp:perm', function()
    local source = source -- Get the source player ID inside the event

    for k, v in pairs(Config.PermTables) do
        local query = "DELETE FROM " .. k .. " WHERE `" .. v .. "` = @identifier"
        local params = { ['@identifier'] = QBCore.Functions.GetPlayer(source).PlayerData.citizenid }

        QBCore.Functions.ExecuteSql(query, params)
    end

    QBCore.Functions.DropPlayer(source, 'YOU HAVE DIED', false)
end)