SA-MP Forums Archive
NEED HELP ABOUT RICHLIST - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: NEED HELP ABOUT RICHLIST (/showthread.php?tid=542471)



NEED HELP ABOUT RICHLIST - ThunderX - 19.10.2014

pawn Код:
CMD:richlist(playerid, params[])
{
    new string[128],
        Slot1 = -1,
        Slot2 = -1,
        Slot3 = -1,
        Slot4 = -1,
        HighestCash = -9999
    ;
    SendClientMessage(playerid, COLOR_GREEN, "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;
}
pawn Код:
C:\Users\BOONTAWEE\Desktop\World War 2.0\gamemodes\WORLDWAR1.pwn(454) : error 017: undefined symbol "GetName"
C:\Users\BOONTAWEE\Desktop\World War 2.0\gamemodes\WORLDWAR1.pwn(458) : error 017: undefined symbol "GetName"
C:\Users\BOONTAWEE\Desktop\World War 2.0\gamemodes\WORLDWAR1.pwn(463) : error 017: undefined symbol "GetName"
C:\Users\BOONTAWEE\Desktop\World War 2.0\gamemodes\WORLDWAR1.pwn(468) : error 017: undefined symbol "GetName"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
how to fix error 017: undefined symbol "GetName"


Re: NEED HELP ABOUT RICHLIST - xWarrior - 19.10.2014

Put this somewhere in your script

Код:
stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}



Re: NEED HELP ABOUT RICHLIST - ThunderX - 19.10.2014

thank you


Re: NEED HELP ABOUT RICHLIST - xWarrior - 19.10.2014

Quote:
Originally Posted by ThunderX
Посмотреть сообщение
thank you
Your welcome