qb-gangs
isPlayerJobMatching with gangs:
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
endHow to add to tattoo
Last updated