> For the complete documentation index, see [llms.txt](https://documentation.rcore.cz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.rcore.cz/paid-resources/rcore_tattoos/integrations/qbgangs.md).

# qb-gangs

If you are using the new QB gangs functions, you can easily integrate it to our job restricted tattoos.

1. open the file `rcore_tattoos\client\api\helper.lua`
2. Replace whole `isPlayerJobMatching` function with the code below
3. Add gang name and gang grades same way as adding job permission to tattoo (check **How to** below)

### `isPlayerJobMatching` with gangs:

```lua
function isPlayerJobMatching(tattooJobs, playerJob)
    if not playerJob or not playerJob.name then
        dbg.info('isPlayerJobMatching: playerJob not passed!')
        return false
    end

    -- qb-gangs
    local pData
    local gangName = nil
    local gangGrade = nil

    if QBCore then
        pData = QBCore.Functions.GetPlayerData() or nil
    end

    if pData and pData.gang then
        gangName = pData.gang.name or nil

        if pData.gang.grade ~= nil then
            gangGrade = pData.gang.grade.level or nil
        end
    end
    -----------

    for _, tattooJob in pairs(tattooJobs) do
        if not tattooJob.name then
            dbg.error('isPlayerJobMatching: Missing job name in tattoo permissions config!')
            break
        end

        if tattooJob.name == playerJob.name then
            if playerJob.grade == nil and tattooJob.grade == nil then
                return true
            end
            
            if tattooJob.grade == nil then
                return true
            end

            if playerJob.grade ~= nil and playerJob.grade >= tattooJob.grade then
                return true
            end
        elseif tattooJob.name == gangName then
            if gangGrade == nil and tattooJob.grade == nil then
                return true
            end
            
            if tattooJob.grade == nil then
                return true
            end

            if gangGrade ~= nil and gangGrade >= tattooJob.grade then
                return true
            end
        end
    end
end
```

### **How to add to tattoo**

You can add it the same way, as when you are adding job restriction to tattoo.

{% hint style="danger" %}
Don't name it 'gangs'! Keep the name 'jobs' as if you were adding normal job!
{% endhint %}

```lua
"permissions": {
    "jobs": [ -- it will still be called jobs, not gangs!
        {
            "name": "bloods", -- gang name
            "grade": 1 -- minimal gang grade to show the tattoo - not required
        },  
    ],
},
```
