hey how to make top 5
#1

guys help me how i make this plz give me code
Reply
#2

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

i am not success plz help
Reply
#4

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.
Reply
#5

i already make saving sys but i want this plz help
Reply
#6

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
Reply
#7

shit then plz help
Reply
#8

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

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
Reply
#10

Hey anyone plz help here i want that code in textdraws
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)