Top 5 Drifters
#1

Hi!

I found Ryders Top 5 Killers and i made it Top 5 Drifters, all works fine, but when player disconnect the server, then i'ts not saving to list, like when im come back, it dosen't there. And i made that, when player have 400 DriftingScore then he get to the list. DriftScore saving to Player file.

Sorry for my bad English, i really hope you understand my problem

pawn Код:
// New
new Text: Drifterid_Top5[2];

public OnGameModeInit()
{
    SetGameModeText("EESTI FUN 0.1");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
   
    SetTimer("Drift", 200, true);
    SetTimer("AngleUpdate", 200, true);
   
    // Top 5 Drifters
    Drifterid_Top5[0] = TextDrawCreate(79.000000, 135.000000, "Top 5 Drifterid");
    TextDrawAlignment(Drifterid_Top5[0], 2);
    TextDrawBackgroundColor(Drifterid_Top5[0], 255);
    TextDrawFont(Drifterid_Top5[0], 1);
    TextDrawLetterSize(Drifterid_Top5[0], 0.280000, 1.499999);
    TextDrawColor(Drifterid_Top5[0], -1);
    TextDrawSetOutline(Drifterid_Top5[0], 0);
    TextDrawSetProportional(Drifterid_Top5[0], 1);
    TextDrawSetShadow(Drifterid_Top5[0], 0);

    Drifterid_Top5[1] = TextDrawCreate(16.000000, 135.000000, " ");
    TextDrawBackgroundColor(Drifterid_Top5[1], 255);
    TextDrawFont(Drifterid_Top5[1], 1);
    TextDrawLetterSize(Drifterid_Top5[1], 0.200000, 0.999999);
    TextDrawColor(Drifterid_Top5[1], -1);
    TextDrawSetOutline(Drifterid_Top5[1], 0);
    TextDrawSetProportional(Drifterid_Top5[1], 1);
    TextDrawSetShadow(Drifterid_Top5[1], 0);
    TextDrawUseBox(Drifterid_Top5[1], 1);
    TextDrawBoxColor(Drifterid_Top5[1], 150);
    TextDrawTextSize(Drifterid_Top5[1], 143.000000, 20.000000);
    return 1;
}

CMD:top(playerid, params[])
{
    new valikud[20];
    if(isnull(params))
    {
        return SendClientMessage(playerid, -1, "[KASUTUS]: /top [Drifterid/Tapjad]");
    }
    if(!strcmp(valikud, "drifterid", true)) // TOP DRIFTERS
    {
        new
            playerScores[MAX_PLAYERS][rankingEnum],
            index
        ;
        for(new i; i != MAX_PLAYERS; ++i)
        {
            if(KasutajaInfo[i][DriftiPunktid] >= 500)
            {
                playerScores[index][player_Score] = KasutajaInfo[playerid][DriftiPunktid];
                playerScores[index++][player_ID] = i;
            }
        }
        GetPlayerHighestScores(playerScores, 0, index);

        new TopDrifterid_Tekst[256] = "~n~";
        for(new i; i < 5; ++i)
        {
            if(i < index)
            {
                GetPlayerName(KasutajaInfo[playerid][Nimi], MangijaNimi, sizeof(MangijaNimi));
                format(TopDrifterid_Tekst, sizeof(TopDrifterid_Tekst), "%s~n~~b~%d. ~w~%s - ~r~%d", TopDrifterid_Tekst, i + 1, MangijaNimi, playerScores[i][player_Score]);
            }
            else
                format(TopDrifterid_Tekst, sizeof(TopDrifterid_Tekst), "%s~n~~b~%d. ~r~N/A", TopDrifterid_Tekst, i + 1);
        }
        TextDrawSetString(Drifterid_Top5[1], TopDrifterid_Tekst);
        TextDrawShowForPlayer(playerid, Drifterid_Top5[0]);
        TextDrawShowForPlayer(playerid, Drifterid_Top5[1]);
        return 1;
    }
    if(!strcmp(valikud, "tapjad", true))
    {
        // if they typed business
        // code here.
        return 1;
    }
    return 1;
}

// STOCK
stock GetPlayerHighestScores(array[][rankingEnum], left, right)
{
    new
        tempLeft = left,
        tempRight = right,
        pivot = array[(left + right) / 2][player_Score],
        tempVar
    ;
    while(tempLeft <= tempRight)
    {
        while(array[tempLeft][player_Score] > pivot) tempLeft++;
        while(array[tempRight][player_Score] < pivot) tempRight--;

        if(tempLeft <= tempRight)
        {
            tempVar = array[tempLeft][player_Score], array[tempLeft][player_Score] = array[tempRight][player_Score], array[tempRight][player_Score] = tempVar;
            tempVar = array[tempLeft][player_ID], array[tempLeft][player_ID] = array[tempRight][player_ID], array[tempRight][player_ID] = tempVar;
            tempLeft++, tempRight--;
        }
    }
    if(left < tempRight) GetPlayerHighestScores(array, left, tempRight);
    if(tempLeft < right) GetPlayerHighestScores(array, tempLeft, right);
}
Reply
#2

There's 0 saving functions you gave us in this code? How do you expect something to save if you do not tell it to save?
Reply
#3

Quote:
Originally Posted by MicroD
Посмотреть сообщение
There's 0 saving functions you gave us in this code? How do you expect something to save if you do not tell it to save?
It's saves the DriftingScore!
pawn Код:
public DriftCancellation(playerid)
{
    PlayerDriftCancellation[playerid] = 0;
    AnnaRaha(playerid,DriftPointsNow[playerid],0);
    KasutajaInfo[playerid][DriftiPunktid] = KasutajaInfo[playerid][DriftiPunktid] + DriftPoints[playerid];
    DriftPointsNow[playerid] = 0;
    DriftPoints[playerid] = 0;
    scores[playerid] = 0;
    TextDrawHideForPlayer(playerid, Chet[playerid]);
    TextDrawHideForPlayer(playerid, ChetP[playerid]);
}
This is the problem, it don't save the Top 5 Drifters List, i want to do that, but how?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)