joshua1n
joshua1n
CC#
Created by joshua1n on 3/20/2023 in #help
❔ How would I go about looping through a json file and search for the highest value in a category?
I know how to pull the values but not sure how I would compare all the values
timer.Repeat(10f, 0, () =>
{
foreach(BasePlayer player in BasePlayer.activePlayerList)
{
string playerID = player.userID.ToString();
string playerStatsJson = dataFile[playerID] as string;
Stats playerStats = JsonConvert.DeserializeObject<Stats>(playerStatsJson);

int kills = playerStats.kills;

if (player kills > * other player kills)
{
// code here
}
}
});
timer.Repeat(10f, 0, () =>
{
foreach(BasePlayer player in BasePlayer.activePlayerList)
{
string playerID = player.userID.ToString();
string playerStatsJson = dataFile[playerID] as string;
Stats playerStats = JsonConvert.DeserializeObject<Stats>(playerStatsJson);

int kills = playerStats.kills;

if (player kills > * other player kills)
{
// code here
}
}
});
6 replies