SA-MP Forums Archive
hey how to make top 5 - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: hey how to make top 5 (/showthread.php?tid=250391)



hey how to make top 5 - Bilawal2050 - 23.04.2011

guys help me how i make this plz give me code



Re: hey how to make top 5!!! - GangsTa_ - 23.04.2011

You can start by saving the kills into a file, then use variables to show them like that.


Re: hey how to make top 5!!! - Bilawal2050 - 23.04.2011

i am not success plz help


Re: hey how to make top 5!!! - GangsTa_ - 23.04.2011

Here I can't really help you, it will take a long time, but:
If you got a score/password and shi' saving system, you can also use Dini or whatever your using for editing your files.
Under OnPlayerDeath, use GetPlayerName(killerid); by creating a variable.
Then use Dini to edit the file. After your done with the kills saving system, I don't know, you can use the Dini GET function, for adding it into the server. But not sure how to make it into a top.


Re: hey how to make top 5!!! - Bilawal2050 - 23.04.2011

i already make saving sys but i want this plz help


Re: hey how to make top 5!!! - Kwarde - 23.04.2011

UNTESTED, I'm NOT SURE IF IT'll WORK
pawn Code:
#include <a_samp>

new top5[5][2];

stock GetP1()
{
    new HighestScore = cellmin, LastHighest = INVALID_PLAYER_ID;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(GetPlayerScore(i) > HighestScore){
            HighestScore = GetPlayerScore(i);
            LastHighest = i;
        }
    }
    return top5[0][0] = LastHighest, top5[0][1] = HighestScore;
}

stock GetP2()
{
    new HighestScore = cellmin, LastHighest = INVALID_PLAYER_ID;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if((GetPlayerScore(i) > HighestScore) && (GetPlayerScore(i) < top5[0][1])){
            HighestScore = GetPlayerScore(i);
            LastHighest = i;
        }
    }
    return top5[1][0] = LastHighest, top5[1][1] = HighestScore;
}

stock GetP3()
{
    new HighestScore = cellmin, LastHighest = INVALID_PLAYER_ID;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if((GetPlayerScore(i) > HighestScore) && (GetPlayerScore(i) < top5[1][1])){
            HighestScore = GetPlayerScore(i);
            LastHighest = i;
        }
    }
    return top5[2][0] = LastHighest, top5[2][1] = HighestScore;
}

stock GetP4()
{
    new HighestScore = cellmin, LastHighest = INVALID_PLAYER_ID;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if((GetPlayerScore(i) > HighestScore) && (GetPlayerScore(i) < top5[2][1])){
            HighestScore = GetPlayerScore(i);
            LastHighest = i;
        }
    }
    return top5[3][0] = LastHighest, top5[3][1] = HighestScore;
}

stock GetP5()
{
    new HighestScore = cellmin, LastHighest = INVALID_PLAYER_ID;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if((GetPlayerScore(i) > HighestScore) && (GetPlayerScore(i) < top5[3][1])){
            HighestScore = GetPlayerScore(i);
            LastHighest = i;
        }
    }
    return top5[4][0] = LastHighest, top5[4][1] = HighestScore;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/top5")){
        new str[128], pName[5][MAX_PLAYER_NAME];
        GetP1();
        GetP2();
        GetP3();
        GetP4();
        GetP5();
        GetPlayerName(top5[0][0], pName[0], MAX_PLAYER_NAME);
        GetPlayerName(top5[1][0], pName[1], MAX_PLAYER_NAME);
        GetPlayerName(top5[2][0], pName[2], MAX_PLAYER_NAME);
        GetPlayerName(top5[3][0], pName[3], MAX_PLAYER_NAME);
        GetPlayerName(top5[4][0], pName[4], MAX_PLAYER_NAME);
        format(str, 128, "Nr.1: %s || Nr.2: %s || Nr.3: %s || Nr.4: %s || Nr.5: %s", pName[0], pName[1], pName[2], pName[3], pName[4]);
        SendClientMessageToAll(0xFFFFFFAA, str);
    }
    return 1;
}
I'm sure it can be made shorter, and better. But this is just a fast one. Try it . Atleast it doesn't give any warnings or errors. Do ingame the command /top5


Re: hey how to make top 5!!! - Bilawal2050 - 23.04.2011

shit then plz help


Re: hey how to make top 5!!! - Salsa - 23.04.2011

Hello Im swat4-samp Develover i will check this an post my commet there soon


Re: hey how to make top 5!!! - Salsa - 23.04.2011

i check it but its not good when player type /top5 it will show to player

But we want it on textdraw for all top5 killers


Re: hey how to make top 5!!! - wheelman_WM - 23.04.2011

Hey anyone plz help here i want that code in textdraws