(AI) We are a bit busy now.
Tested in game, it works well.
PHP Code:
new g_iKeys[33] = {10, 5, 8, 12, 3, 15, 7, 9, 2, 6, 11, 4, 1, 14, 13, 20, 18, 19, 16, 17, 25, 22, 21, 23, 27, 24, 26, 30, 29, 31, 28, 32, 33};
new g_iTopValues[5];
new g_iTopIndices[5];
PHP Code:
for (new i = 0; i < sizeof(g_iKeys); i++)
{
for (new j = 0; j < sizeof(g_iTopValues); j++)
{
if (g_iKeys[i] > g_iTopValues[j])
{
// Shift the values and indices to make room for the new value
for (new k = sizeof(g_iTopValues) - 1; k > j; k--)
{
g_iTopValues[k] = g_iTopValues[k - 1];
g_iTopIndices[k] = g_iTopIndices[k - 1];
}
// Assign the new value and index to the correct position
g_iTopValues[j] = g_iKeys[i];
g_iTopIndices[j] = i;
break;
}
}
}
for (new i = 0; i < sizeof(g_iTopValues); i++)
{
client_print(id,print_chat,"Value: %d, Index: %d", g_iTopValues[i], g_iTopIndices[i])
}
__________________