Make to Dialog
#1

How to make this to DIALOG_STYLE_MSGBOX? When I do /top5 then the top 5 killer should show in a dialog.

pawn Код:
//Enums
enum rankingEnum
{
    player_Score,
    player_ID
}
forward UpDateTextDraw(playerid);

//Textdraws
new Text: text_Top5[2];

public OnFilterScriptInit()
{
    SetTimer("UpDateTextDraw",1000,1);
    ////////////////////////////score board//////////////////////////////////////////////////
    text_Top5[0] = TextDrawCreate(39.000000, 181.000000, "TOP ~r~5 ~w~SHOOTERS");
    TextDrawBackgroundColor(text_Top5[0], 255);
    TextDrawFont(text_Top5[0], 2);
    TextDrawLetterSize(text_Top5[0], 0.309998, 2.000000);
    TextDrawColor(text_Top5[0], -1);
    TextDrawSetOutline(text_Top5[0], 1);
    TextDrawSetProportional(text_Top5[0], 1);

    text_Top5[1] = TextDrawCreate(14.000000, 175.000000, "r");
    TextDrawBackgroundColor(text_Top5[1], 255);
    TextDrawFont(text_Top5[1], 1);
    TextDrawLetterSize(text_Top5[1],  0.309997, 1.399998);
    TextDrawColor(text_Top5[1], -1);
    TextDrawSetOutline(text_Top5[1], 1);
    TextDrawSetProportional(text_Top5[1], 1);
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

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);
}
public UpDateTextDraw(playerid)
{
    new
        playerScores[MAX_PLAYERS][rankingEnum],
        index
    ;
    for(new i; i != MAX_PLAYERS; ++i)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            playerScores[index][player_Score] = GetPlayerScore(i);
            playerScores[index++][player_ID] = i;
        }
    }
    GetPlayerHighestScores(playerScores, 0, index);

    new
    score_Text[256] = "~n~",
    player_Name[20]
    ;
    for(new i; i < 5; ++i)
    {
    if(i < index)
    {
    GetPlayerName(playerScores[i][player_ID], player_Name, sizeof(player_Name));
    format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~w~%s - ~r~%d~w~ - kills", score_Text, i + 1, player_Name, playerScores[i][player_Score]);
    }
    else
    format(score_Text, sizeof(score_Text), "%s~n~~b~%d.", score_Text, i + 1);
    }
    TextDrawSetString(text_Top5[1], score_Text);
    TextDrawShowForAll(text_Top5[1]);
    TextDrawShowForAll(text_Top5[0]);
    return 1;
    }
Reply
#2

this might help you
http://forum.sa-mp.com/showpost.php?...2&postcount=44
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)