09.10.2018, 11:52
You can use a for loop, to loop from 0 to size - 1 (where size the size of the array, since indexes start at zero the last index will be size - 1).
Similar to a for-loop looping through all players, but here MAX_PLAYERS would be the size of the array (the rest is the same, if you know what I mean). If you use i as variable for the loop, you can use i for the index of the array.
To check if all the indexes have the same value, you can declare a variable (bool for clarity) before the array and set it to true or 1.
While looping through the array, you can check if the current index has the value you want. If it doesn't set the aforementioned variable to false or 0.
After the loop finished, you can then know if any value is different if the variable is true or false.
Similar to a for-loop looping through all players, but here MAX_PLAYERS would be the size of the array (the rest is the same, if you know what I mean). If you use i as variable for the loop, you can use i for the index of the array.
To check if all the indexes have the same value, you can declare a variable (bool for clarity) before the array and set it to true or 1.
While looping through the array, you can check if the current index has the value you want. If it doesn't set the aforementioned variable to false or 0.
After the loop finished, you can then know if any value is different if the variable is true or false.