mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 08:13:21 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user