The issue:
Game stats, created in mpstatssetup.xml
to be precise, has different types and settings, which allow (or doesn’t allow. foreshadowing.) to be modified or retrieved from within resources.
For example, StatSet_*
cannot modify stats that are created with ServerAuthoritative="true"
or Owner="coder" or Owner="system"
or characterStat="true"
, which is understandable in GTA5 / GTA Online, but it’s just restrictive in FiveM.
Those restrictions simply blocks a lot of stats from being used (and sometimes abused) by resource developers, and adds and eye-sore in the STATS tab of the pausemenu, because mpstatssetupui.xml
sets all the stats as “ALWAYS_VISIBLE”.
While we do have access to data_file
mounters for both of those, it cannot be used to modify stats or the ui, just to add stats on top of it.
The proposal:
A) Setup a way for resources to somehow overwrite these files. If that is possible, chaning pausemenu.xml
is just around the corner.
OOORRRR
B) Add modified mpstatssetupui.xml
and mpstatssetup.xml
in [ FiveM Application Data\citizen\common\data\ui ] (the same way we have pausemenu.xml
), with modified stats that can be modified by scripts, through StatSet_*
. mpstatssetupui.xml
can also be modified to set all stats as “AFTER_INCREMENT”, which basically hides unused stats in the pausemenu.
I already tried this and at first glance it works, but with some jank.
There isn’t a way to hide the stats categories, which can be seen as “bugged” by some players, because no stats are shown (R* hides this with a text card.)
Not sure if it’s part of the .gfx file, or if there is some unused variable in the .xml file.
High Points:
Allowing stats to be changed, and hiding unused stats from the menu, allows server owners to better integrate their scripts within the game. Servers can already add new custom stats, but it’s not that usefull since they get sent below all the unused (and most of them unusable) default stats.
Risks:
Changing the stats owner
fields from “coder”(or worse, “hardware”) to “script” might have some unforseen consequences. Hits, Shots, Deaths, and Time Played will most likely stop working automatically in the Stats menu, but I’m not sure hgw much is the game relying on them in the backend.
Changing the characterStat
field might be problematic as well, but I haven’t found any side effect of that.