From 85819bddbfbfbf1522352aae2932366560821dd3 Mon Sep 17 00:00:00 2001 From: Mojito-Fivem Date: Sun, 7 Nov 2021 22:46:00 +0000 Subject: [PATCH] feat(server/functions): GetDutyCount --- server/functions.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/functions.lua b/server/functions.lua index ec98de6..34df851 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -92,6 +92,19 @@ function QBCore.Functions.GetPlayersOnDuty(job) return players, count end +function QBCore.Functions.GetDutyCount(job) + local count = 0 + + for _, Player in pairs(QBCore.Players) do + if Player.PlayerData.job.name == job then + if Player.PlayerData.job.onduty then + count = count + 1 + end + end + end + return count +end + -- Paychecks (standalone - don't touch) function PaycheckLoop()