Richlist?
#3

Didnt tested it
pawn Код:
CMD:richlist(playerid, params[])
{
    new
        string[128],
        Slot1 = -1,
        Slot2 = -1,
        Slot3 = -1,
        Slot4 = -1,
        HighestCash = -9999
    ;
    SendClientMessage(playerid, COLOR_LIGHTGREEN, "Rich List:");

    for(new x=0; x<MAX_PLAYERS; x++)
    if(IsPlayerConnected(x))
    if(GetPlayerMoney(x) >= HighestCash)
    {
        HighestCash = GetPlayerMoney(x);
        Slot1 = x;
    }
    HighestCash = -9999;
    for(new x=0; x<MAX_PLAYERS; x++)
    if(IsPlayerConnected(x) && x != Slot1)
    if(GetPlayerMoney(x) >= HighestCash)
    {
        HighestCash = GetPlayerMoney(x);
        Slot2 = x;
    }
    HighestCash = -9999;
    for(new x=0; x<MAX_PLAYERS; x++)
    if(IsPlayerConnected(x) && x != Slot1 && x != Slot2)
    if(GetPlayerMoney(x) >= HighestCash)
    {
        HighestCash = GetPlayerMoney(x);
        Slot3 = x;
    }
    HighestCash = -9999;
    for(new x=0; x<MAX_PLAYERS; x++)
    if(IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3)
    if(GetPlayerMoney(x) >= HighestCash)
    {
        HighestCash = GetPlayerMoney(x);
        Slot4 = x;
    }
    format(string, sizeof(string), "(%d) Player %s - $%d", Slot1, GetName(Slot1), GetPlayerMoney(Slot1));
    SendClientMessage(playerid, COLOR_WHITE, string);
    if(Slot2 != -1)
    {
        format(string, sizeof(string), "(%d) Player %s - $%d", Slot2, GetName(Slot2), GetPlayerMoney(Slot2));
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    if(Slot3 != -1)
    {
        format(string, sizeof(string), "(%d) Player %s - $%d", Slot3, GetName(Slot3), GetPlayerMoney(Slot3));
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    if(Slot4 != -1)
    {
        format(string, sizeof(string), "(%d) Player %s - $%d", Slot4, GetName(Slot4), GetPlayerMoney(Slot4));
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    return 1;
}
Reply


Messages In This Thread
Richlist? - by ajam123 - 02.08.2014, 07:47
Re: Richlist? - by dirigent00 - 02.08.2014, 07:51
Re: Richlist? - by SHE790 - 02.08.2014, 07:58
Re: Richlist? - by ajam123 - 02.08.2014, 08:00
Re: Richlist? - by Adornil - 21.11.2015, 11:41
Re: Richlist? - by N0FeaR - 21.11.2015, 12:03
Re: Richlist? - by Adornil - 21.11.2015, 12:24

Forum Jump:


Users browsing this thread: 1 Guest(s)