Merge pull request #312 from Mojito-Fivem/feat/GetDuty

Feat/get duty
This commit is contained in:
Kakarot
2021-11-07 20:59:54 -06:00
committed by GitHub
+31
View File
@@ -76,6 +76,37 @@ end
function QBCore.Functions.GetQBPlayers()
return QBCore.Players
end
--- Gets a list of all on duty players of a specified job and the number
function QBCore.Functions.GetPlayersOnDuty(job)
local players = {}
local count = 0
for src, Player in pairs(QBCore.Players) do
if Player.PlayerData.job.name == job then
if Player.PlayerData.job.onduty then
players[#players + 1] = src
count = count + 1
end
end
end
return players, count
end
-- Returns only the amount of players on duty for the specified job
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()