private class PVEStatsData
{
public int heavyKills = 0;
public int scientistkills = 0;
public int murdererkills = 0;
public int scarecrowkills = 0;
public int points = 0;
public string rank;
internal static void TryLoad(ulong id)
{
if (Cachedplayerstats.ContainsKey(id)) return;
PVEStatsData data = Interface.Oxide.DataFileSystem.ReadObject<PVEStatsData>($"NPCKillCounter/{id}");
if (data == null) data = new PVEStatsData();
Cachedplayerstats.Add(id, data);
}
internal static void Reset(ulong id)
{
PVEStatsData data = Interface.Oxide.DataFileSystem.ReadObject<PVEStatsData>($"NPCKillCounter/{id}");
if (data == null) return;
data = new PVEStatsData();
data.Save(id);
}
internal static void resetcache(ulong id)
{
if (!Cachedplayerstats.ContainsKey(id)) PVEStatsData.TryLoad(id);
Cachedplayerstats[id].heavyKills = 0;
Cachedplayerstats[id].scarecrowkills = 0;
Cachedplayerstats[id].scientistkills = 0;
Cachedplayerstats[id].murdererkills = 0;
Cachedplayerstats[id].points = 0;
}
internal void Save(ulong id) => Interface.Oxide.DataFileSystem.WriteObject(($"NPCKillCounter/{id}"), this, true);
}if (Cachedplayerstats[player.userID].points == rank1)
{
player.IPlayer.AddToGroup((string)Config["Rank1"]);
Cachedplayerstats[player.userID].rank = (string)Config["Rank1"];
}I have this and its supposed to set the players rank in the data file to the one in the config, when a player reaches a certain amount of points. I have done something wrong as in the data file, the value for rank will only show up as null. I am not sure what i have done wrong, can someone help me plz?