Get the max gang score
#2

This will just find the largest score, like you're trying to do
pawn Код:
if(strcmp("/toplist", cmd, true) == 0)
{
    new max = GangInfo[0][gangScore];
    for(new i = 0; i < MAX_GANGS; i++)
    {
        if(GangInfo[i][gangScore] > max)
        {
            max = GangInfo[i][gangScore];
        }
    }
    format(string, sizeof(string), "%d", max);
    SendClientMessageToAll(rot,string);
}
And this will give you the index of the gang with the highest score (maxi)
pawn Код:
if(strcmp("/toplist", cmd, true) == 0)
{
    new max = GangInfo[0][gangScore];
    new maxi;
    for(new i = 0; i < MAX_GANGS; i++)
    {
        if(GangInfo[i][gangScore] > max)
        {
            max = GangInfo[i][gangScore];
            maxi = i;
        }
    }
    format(string, sizeof(string), "%d", GangInfo[maxi][gangScore]);
    SendClientMessageToAll(rot,string);
}
Reply


Messages In This Thread
Get the max gang score - by Headshot1108 - 06.03.2010, 11:08
Re: Get the max gang score - by dice7 - 06.03.2010, 11:37
Re: Get the max gang score - by Headshot1108 - 06.03.2010, 12:44
Re: Get the max gang score - by ipsBruno - 17.04.2010, 02:43

Forum Jump:


Users browsing this thread: 1 Guest(s)