Add job count management on player events

Introduces event handlers to update job counts when players load, change jobs, or unload across multiple framework modules. Ensures job count tracking stays accurate by adding or removing counts based on player actions. (would like to update this to have some client event tables?)
This commit is contained in:
MrNewb committed 2025-08-31 22:49:29 -04:00
1 parent c399fbaca4
commit 9fdb41e9f6
4 files changed
+19

No files matched your search

+10
View File
@@ -53,4 +53,14 @@ Framework.RemoveJobCount = function(src, jobName)
return true, #jobsRegisteredTable[jobName]
end
AddEventHandler('community_bridge:Server:OnPlayerJobChange', function(src, newJobName)
local previousJob = Framework.SearchJobCountBySource(src)
if previousJob then Framework.RemoveJobCount(src, previousJob) end
if newJobName then Framework.AddJobCount(src, newJobName) end
end)
AddEventHandler('community_bridge:Server:OnPlayerUnload', function(src)
Framework.RemoveJobCount(src)
end)
return Framework