19.01.2012, 21:38
Now I do. As far as I'm concerned foreach isn't meant to return the users in any sorted order.
I've whipped up a quick sort function for you:
I may as well post this in the code snippets topic.
EDIT:
It doesn't account for doubles of any number in the list, but that shan't be a problem as there shouldn't be doubles of any player ids.
I've whipped up a quick sort function for you:
pawn Код:
sort(list[], const size=sizeof(list))
{
new
i, j, x,
m,
l[MAX_PLAYERS] = { -1, ... };
while(j < size)
{
for(i = 0, m = 0x7FFFFFFF; i < size; ++i)
{
if(list[i] < m)
{
for(x = 0; x < size; ++x)
{
if(l[x] == list[i])
{
goto next;
}
}
m = list[i];
}
next:
}
l[j++] = m;
}
for(i = 0; i < size; ++i)
{
if(l[i] != -1)
{
list[i] = l[i];
}
}
}
EDIT:
It doesn't account for doubles of any number in the list, but that shan't be a problem as there shouldn't be doubles of any player ids.