HELP! Dialog List Problem!
#8

Quote:
Originally Posted by Tannz0rz
Посмотреть сообщение
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:
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];
        }
    }
}
I may as well post this in the code snippets topic.
"m = 0x7FFFFFFF"
What's that for?
Reply


Messages In This Thread
HELP! Dialog List Problem! - by SuperChock - 19.01.2012, 20:16
Re: HELP! Dialog List Problem! - by Tannz0rz - 19.01.2012, 20:36
Re: HELP! Dialog List Problem! - by SuperChock - 19.01.2012, 20:48
Re: HELP! Dialog List Problem! - by Tannz0rz - 19.01.2012, 21:01
Re: HELP! Dialog List Problem! - by SuperChock - 19.01.2012, 21:04
Re: HELP! Dialog List Problem! - by viper_viper - 19.01.2012, 21:32
Re: HELP! Dialog List Problem! - by Tannz0rz - 19.01.2012, 21:38
Re: HELP! Dialog List Problem! - by FireCat - 19.01.2012, 21:42
Re: HELP! Dialog List Problem! - by Tannz0rz - 19.01.2012, 21:43
Re: HELP! Dialog List Problem! - by FireCat - 19.01.2012, 21:46

Forum Jump:


Users browsing this thread: 1 Guest(s)