feat(es_extended): dd isNew state to Player stateBag on playerLoaded

Stores the isNew flag in the player's stateBag on server. 
On the client, you can get it like this:
```
 print(Player(source).state.isNew)
```

- [x]  My commit messages and PR title follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard.
- [x]  My changes have been tested locally and function as expected.
- [x]  My PR does not introduce any breaking changes.
- [x]  I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.
This commit is contained in:
Mr Sneaky
2025-08-22 16:30:50 +02:00
committed by GitHub
parent c64a3b5def
commit c2d7898e1f
+2 -1
View File
@@ -331,12 +331,13 @@ AddEventHandler("playerDropped", function(reason)
end
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]
Player(xPlayer.source).state:set('isNew', isNew, true)
end)
AddEventHandler("esx:setJob", function(_, job, lastJob)