Describe the Feature
With the new version (1.11.*) and the integration of job duty, it would be useful to alter the data in ESX.JobsPlayerCount to not only reflect the number of connected players with the job but also players with the job active.
This could also be done with another system in parallel with an object called something like ESX.JobsOnDutyPlayerCount.
Screenshots
This is only rough idea to detail the imagined concept
AddEventHandler("esx:setJob", function(_, job, lastJob)
local lastJobKey = ("%s:count"):format(lastJob.name)
local jobKey = ("%s:count"):format(job.name)
local currentLastJob = ESX.JobsPlayerCount[lastJob.name] or {players: 0, onDuty: 0}
local currentNewJob = ESX.JobsPlayerCount[lastJob.name] or {players: 0, onDuty: 0}
ESX.JobsPlayerCount[lastJob.name] = {
players: currentLastJob - 1,
onDuty: currentLastJob - (lastJob.onDuty and 1 or 0)
}
ESX.JobsPlayerCount[job.name] = {
players: currentNewJob + 1,
onDuty: currentNewJob + (job.onDuty and 1 or 0)
}
GlobalState[lastJobKey] = ESX.JobsPlayerCount[lastJob.name]
GlobalState[jobKey] = ESX.JobsPlayerCount[job.name]
end)
Additional context
This can be very useful for scripts that check if any players are on duty to allow/deny the use of certain functionalities.
Describe the Feature
With the new version (1.11.*) and the integration of job duty, it would be useful to alter the data in
ESX.JobsPlayerCountto not only reflect the number of connected players with the job but also players with the job active.This could also be done with another system in parallel with an object called something like
ESX.JobsOnDutyPlayerCount.Screenshots
This is only rough idea to detail the imagined concept
Additional context
This can be very useful for scripts that check if any players are on duty to allow/deny the use of certain functionalities.