Richlist?
#1

Hello all pro samp script. I wanted to ask, how to make richlisting for roleplay gamemode? For example:

pawn Код:
the command will be /richlist

and it's shows like this

Rich list TOP 3
1. Player1 - $5
2. Player2 - $3
3. Player3 - $1
Reply
#2

Use variables, set the player with ID 0 as the richest player, loop all players, and if someone have more money then him, set him as the richest, and this one, move to the second pos.
Reply
#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
#4

I have, but i want overall money combined with hands+bank.

example: in hands they have $5 and bank $5, so it's will be $10 in total
Reply
#5

where I have to post this code's in gamemode or in filterscript

and also if in filterscript than please give me whole code
Reply
#6

Quote:
Originally Posted by Adornil
Посмотреть сообщение
where I have to post this code's in gamemode or in filterscript

and also if in filterscript than please give me whole code
It depends where u want it lol.
Reply
#7

i put it in pawno it's gave so many error
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)