getting highest money on server..
#1

How to get top 5 richest guys on server online?
Reply
#2

Try adding this under your command:

pawn Код:
new first = -1, second = -1, third = -1, fourth = -1, fifth = -1, firstamount, secondamount, thirdamount, fourthamount, fifthamount;
for(i=0;i<MAX_PLAYERS;i++)
{
    if(GetPlayerMoney(i)>firstamount)
    {
        first=i;
    }
    else if(GetPlayerMoney(i)>secondamount)
    {
        second=i;
    }
    else if(GetPlayerMoney(i)>thirdamount)
    {
        third=i;
    }
    else if(GetPlayerMoney(i)>fourthamount)
    {
        fourth=i;
    }
    else if(GetPlayerMoney(i)>fifthamount)
    {
        fifth=i;
    }
    else return 1;
}
new string[30]
SendClientMessage(playerid, COLOUR, "Richest people online now:");
format(string, sizeof(string), "1: %s", GetPlayerName(first);
SendClientMessage(playerid, COLOUR, string);
if(second != -1)
{
    format(string, sizeof(string), "2: %s", GetPlayerName(second);
    SendClientMessage(playerid, COLOUR, string);
}
if(third != -1)
{
    format(string, sizeof(string), "3: %s", GetPlayerName(third);
    SendClientMessage(playerid, COLOUR, string);
}
if(fourth != -1)
{
    format(string, sizeof(string), "4: %s", GetPlayerName(fourth);
    SendClientMessage(playerid, COLOUR, string);
}
if(fifth != -1)
{
    format(string, sizeof(string), "5: %s", GetPlayerName(fifth);
    SendClientMessage(playerid, COLOUR, string);
}
EDIT: Don't use that actually, it won't work if someone is in first, then someone comes above them.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)