That's one way. I would format the message inside the loop instead of using those variables. But you may need them somewhere else of course. Then they really should be an array instead of 5 separate variables.
If we're going to use the code you provided there's no point of looping it since we know what indexes we want.
Code:
for ( new i = 0 ; i < clamp(iPlayersnum, 0, 5) ; i++ )
{
switch(i)
{
case 0: g_iFirstPlace = iPlayers[i]
case 1: g_iSecondPlace = iPlayers[i]
case 2: g_iThirdPlace = iPlayers[i]
case 3: g_iFourthPlace = iPlayers[i]
case 4: g_iFifthPlace = iPlayers[i]
}
}
-->
Code:
g_iFirstPlace = iPlayers[0]
g_iSecondPlace = iPlayers[1]
g_iThirdPlace = iPlayers[2]
g_iFourthPlace = iPlayers[3]
g_iFifthPlace = iPlayers[4]
__________________