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:

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.

Don't name it 'gangs'! Keep the name 'jobs' as if you were adding normal job!

"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
        },  
    ],
},

Last updated