bug with richest players
#1

pawn Код:
CMD:highest(playerid, params[])
{
        new place[5], playaname[5], pdolla[5], richname[5], highestcash = -9999;
        SendClientMessage(playerid, COLOR_GREEN, ".........Top List.........");
        foreach(Player, i)
        {
            if(playerVariables[i][pMoney] > highestcash)
            {
                highestcash = playerVariables[i][pMoney];
                pdolla[0] = playerVariables[i][pMoney];
                place[0] = i;
                richname[0] = GetPlayerName(i, playaname[0], MAX_PLAYER_NAME);
               
            }
        }
        highestcash = -9999;
        foreach(Player, i)
        {
            if(i != place[0])
            if(playerVariables[i][pMoney] > highestcash)
            {
                highestcash = playerVariables[i][pMoney];
                pdolla[1] = playerVariables[i][pMoney];
                place[1] = i;
                richname[1] = GetPlayerName(i, playaname[1], MAX_PLAYER_NAME);
            }
        }
        highestcash = -9999;
        foreach(Player, i)
        {
            if(i != place[0] && i != place[1])
            if(playerVariables[i][pMoney] > highestcash)
            {
                highestcash = playerVariables[i][pMoney];
                place[2] = i;
                pdolla[2] = playerVariables[i][pMoney];
                richname[2] = GetPlayerName(i, playaname[2], MAX_PLAYER_NAME);
               
            }
        }
        highestcash = -9999;
        foreach(Player, i)
        {
            if(i != place[0] && i != place[1] && i != place[2])
            if(playerVariables[i][pMoney] > highestcash)
            {
            highestcash = playerVariables[i][pMoney];
            place[3] = i;
            pdolla[3] = playerVariables[i][pMoney];
            richname[3] = GetPlayerName(i, playaname[3], MAX_PLAYER_NAME);
            }
        }
        highestcash = -9999;
        foreach(Player, i)
        {
            if(i != place[0] && i != place[1] && i != place[2] && i != place[3])
            if(playerVariables[i][pMoney] > highestcash)
            {
                highestcash = playerVariables[i][pMoney];
                place[4] = i;
                pdolla[4] = playerVariables[i][pMoney];
                richname[4] = GetPlayerName(i, playaname[4], MAX_PLAYER_NAME);
            }
        }
        format(szMessage, 256, "1st place [%d]%s    |   $%d", place[0], richname[0], pdolla[0]);
        SendClientMessage(playerid, -1, szMessage);
        if(place[1] != -1)
        {
        format(szMessage, 256, "2nd place [%d]%s    |   $%d", place[1], richname[1], pdolla[1]);
        SendClientMessage(playerid, -1, szMessage);
        }
        if(place[2] != -1)
        {
        format(szMessage, 256, "3rd place [%d]%s    |   $%d", place[2], richname[2], pdolla[2]);
        SendClientMessage(playerid, -1, szMessage);
        }
        if(place[3] != -1)
        {
        format(szMessage, 256, "4th place [%d]%s    |   $%d", place[3], richname[3], pdolla[3]);
        SendClientMessage(playerid, -1, szMessage);
        }
        if(place[4] != -1)
        {
        format(szMessage, 256, "5th place [%d]%s    |   $%d", place[4], richname[4], pdolla[4]);
        SendClientMessage(playerid, -1, szMessage);
        }
        return 1;
}
This is the outcome...
pawn Код:
[02:22:12] .........Top List.........

[02:22:12] 1st place [105]     @@@@@NNNNNiko[duS] | $123456

[02:22:12] 2nd place [107]    @@@@@NNNNNiko[duS] | $123456

[02:22:12] 3rd place [111]   @@@@@NNNNNiko[duS] | $123456

[02:22:12] 4th place [91]  @@@@@NNNNNiko[duS] | $123456

[02:22:12] 5th place [100] @@@@@NNNNNiko[duS] | $123456
Reply


Messages In This Thread
bug with richest players - by GwENiko - 07.11.2014, 03:41
Re: bug with richest players - by ThunderX - 07.11.2014, 05:40
Re: bug with richest players - by GwENiko - 07.11.2014, 06:07

Forum Jump:


Users browsing this thread: 1 Guest(s)