diff --git a/server/main.lua b/server/main.lua index 062fc0a..79e591e 100644 --- a/server/main.lua +++ b/server/main.lua @@ -108,11 +108,7 @@ end) QBCore.Functions.CreateCallback('g-drugselling:server:getCopCount', function(source, cb) local src = source local policeCount = 0 - for _, v in pairs(QBCore.Functions.GetQBPlayers()) do - if v.PlayerData.job.name == "police" and v.PlayerData.job.onduty then - policeCount = policeCount + 1 - end - end - CachedPolice[src] = policeCount - cb(policeCount) -end) \ No newline at end of file + local amount = QBCore.Functions.GetDutyCount("police") + CachedPolice[src] = amount + cb(amount) +end)