Getting the highest number in array of floats in Multiplayer?

Hey, I am trying to figure out a way to find out the MVP Player on my Multiplayer game with KDA Value.

I have all players KDA saved on their PlayerController as a float.

the code above is inside gamemode.

I have a setup like this to figure out the higest kda value in their kda variable but i know something is missing and its clearly not working like this. Can anybody help ? Thx! :slight_smile:

You are creating array of one element every loop iteration. You must create that array before the loop starts, clear it up, fill it in, and then calculate MVP. Something like this (image bellow).

But, to be honest, I would not rely on player index being a player controller ID. What guarantees you that first player in AllPC variable is first player controller (with ID of 0).

Better to make a struct with player ID and player KD, and then do it from the struct. Create array of that struct, extract what you need, and you’re good to go.

1 Like

worked like a charm. Thanks my man!

1 Like