Christmas Patriarch

How to add an ID to the Stats menu for ServerPerks

Since SRStatList is executed on the client, and we need to drag the ID value from the server, we will do this

1. In the ServerPerks.ClientPerkRepLink class, add a variable and its replication to the client

var string PlayerHash;
...
replication
{
    reliable if( Role==ROLE_Authority && bNetOwner )
        ...
        ..., CustomLink, PlayerHash;
...

2. In the ServerPerksMut.ServerStStats class we will add initialization of the PlayerHash variable on the server

function RepCopyStats()
{
    ...
    Rep.LostsCount = MyStatsObject.LostsCount;
    MyStatsObject.GetCustomValues(Rep.CustomLink);
    Rep.PlayerHash = KFPlayerController(Owner).GetPlayerIdHash();
}

Accordingly, since we registered it for replication, it will be duplicated on the client. In fact, RepCopyStats may not be the best place to initialize, but it’s probably ok.

3. Actually, in the ServerPerks.SRStatList class we edit the InitList function and the array in defaultproperties

function InitList( ClientPerkRepLink L )
{
    ...
    StatProgress[25] = string(L.WinsCount);
    StatProgress[26] = string(L.LostsCount);
    StatProgress[27] = L.PlayerHash;
    ...
}
defaultproperties
{
    ...
    ProgressName(25)="Won games"
    ProgressName(26)="Lost games"
    ProgressName(27)="ID"
    ...
}

Result:

Author: Flame