Merge pull request #1709 from MrSne7aky/MrSne7aky-patch-1

feat(es_extended): Add isNew state to Player stateBag on playerLoaded
This commit is contained in:
Kenshin13
2025-08-23 19:38:49 +02:00
committed by GitHub
+4 -1
View File
@@ -374,12 +374,15 @@ AddEventHandler("playerDropped", function(reason)
onPlayerDropped(source --[[@as number]], reason)
end)
AddEventHandler("esx:playerLoaded", function(_, xPlayer)
AddEventHandler("esx:playerLoaded", function(_, xPlayer, isNew)
local job = xPlayer.getJob().name
local jobKey = ("%s:count"):format(job)
Core.JobsPlayerCount[job] = (Core.JobsPlayerCount[job] or 0) + 1
GlobalState[jobKey] = Core.JobsPlayerCount[job]
if isNew then
Player(xPlayer.source).state:set('isNew', true, false)
end
end)
AddEventHandler("esx:setJob", function(_, job, lastJob)