SA-MP Forums Archive
BestKiller - 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: BestKiller (/showthread.php?tid=394862)



BestKiller - NoaM[W] - 24.11.2012

Hello, how i can to check who killed more people?
Example:
1. Name1 - Killed 412 people.
2. Name2 - Killed 348 people.
3. Name3 - Killed 224 people.
4. Name4 - Killed 123 people.


Re: BestKiller - [ABK]Antonio - 24.11.2012

Use a sorting algorithm - search for them, I'm sure you'll find at least two (full code) as ****** and I have both made them.


Re : BestKiller - NoaM[W] - 24.11.2012

https://sampforum.blast.hk/showthread.php?tid=361560 like this?


Re : BestKiller - NoaM[W] - 25.11.2012

Up....


AW: BestKiller - Skimmer - 25.11.2012

Do you have a variable in your script for saving player kills, like pInfo[playerid][pKills] or Kills[playerid]?


Re : BestKiller - NoaM[W] - 25.11.2012

yes T_T


AW: BestKiller - Skimmer - 25.11.2012

Show me the code then I'll script for you.
Do you want it with dialog?


Re : BestKiller - NoaM[W] - 25.11.2012

OnPlayerDeath
Kills[playerid] ++;


AW: BestKiller - Skimmer - 25.11.2012

Try this
pawn Код:
if (strcmp("/best", cmdtext, true, 10) == 0)
{
    new best[4], currentscore = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && Kills[i] > currentscore)
        {
            best[0] = i;
        }
    }
    currentscore = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && Kills[i] > currentscore && i != best[0])
        {
            best[1] = i;
        }
    }
    currentscore = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && Kills[i] > currentscore && i != best[0] && i != best[1])
        {
            best[2] = i;
        }
    }
    currentscore = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && Kills[i] > currentscore && i != best[0] && i != best[1] && i != best[2])
        {
            best[3] = i;
        }
    }
    new string[128];
    format(string, sizeof(string), "%s - Killed %d People\n%s - Killed %d People\n%s - Killed %d People\n%s - Killed %d People", Nick(best[0]), Kills[best[0]], Nick(best[1]), Kills[best[1]], Nick(best[2]), Kills[best[2]], Nick(best[3]), Kills[best[3]]);
    ShowPlayerDialog(playerid, 658, DIALOG_STYLE_MSGBOX, "BestKiller List", string, "Close", "");
   
    return 1;
}



Re : AW: BestKiller - NoaM[W] - 25.11.2012

Quote:
Originally Posted by MouseBreaker
Посмотреть сообщение
Try this
pawn Код:
if (strcmp("/best", cmdtext, true, 10) == 0)
{
    new best[4], currentscore = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && Kills[i] > currentscore)
        {
            best[0] = i;
        }
    }
    currentscore = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && Kills[i] > currentscore && i != best[0])
        {
            best[1] = i;
        }
    }
    currentscore = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && Kills[i] > currentscore && i != best[0] && i != best[1])
        {
            best[2] = i;
        }
    }
    currentscore = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && Kills[i] > currentscore && i != best[0] && i != best[1] && i != best[2])
        {
            best[3] = i;
        }
    }
    new string[128];
    format(string, sizeof(string), "%s - Killed %d People\n%s - Killed %d People\n%s - Killed %d People\n%s - Killed %d People", Nick(best[0]), Kills[best[0]], Nick(best[1]), Kills[best[1]], Nick(best[2]), Kills[best[2]], Nick(best[3]), Kills[best[3]]);
    ShowPlayerDialog(playerid, 658, DIALOG_STYLE_MSGBOX, "BestKiller List", string, "Close", "");
   
    return 1;
}
ty so much!
but my name printed 4 times:
NoaM - Killed 1 People
NoaM - Killed 1 People
NoaM - Killed 1 People
NoaM - Killed 1 People
i can do -
Код:
if(IsPlayerConnected(i) && Kills[i] > currentscore && i != best[0] && i != best[1]  &&  Nick(best[0]) != Nick(best[1]))
??