If you are using the new QB gangs functions, you can easily integrate it to our job restricted tattoos.
isPlayerJobMatching
with gangs:
Copy 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
You can add it the same way, as when you are adding job restriction to tattoo.
Copy "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
},
],
},