top Score and Kill same dialog
#1

It it possible to add Kills board inside 1 dialog? It would be something like this. Im using my mobile i will edit something

Here is the script for top score.
Код HTML:
COMMAND:top(playerid, params[])
{
    mysql_function_query(gSQL, "SELECT `Score`, `PlayerName` FROM `"#MYSQL_TABLE"` ORDER BY `Score` ASC LIMIT 10", true, "TopPlayers", "d", playerid);
    return 1;
Код HTML:
forward TopPlayers(playerid);
public TopPlayers(playerid)
{
    new rows, fields, string[512], name[MAX_PLAYER_NAME], score[20], gscore;

    cache_get_data(rows, fields);

    if(rows > 0)
    {
        for(new i = 0; i < 10; i++)
        {
            cache_get_field_content(i, "Score", score);
            gscore = strval(score);

            if(gScore != 0) cache_get_field_content(i, "PlayerName", name);

            format(string, sizeof(string), "%s%d. %s: %d\n", string, i + 1, (gscore == 0) ? ("Slot Empty") : (name), gscore);
        }
    }

    format(string, sizeof(string), "Most Scored Player\n%s", string);
    ShowPlayerDialog(playerid, 1223, DIALOG_STYLE_MSGBOX, "Top 10", string, "Close");
    return 1;
}
Quote:

Top 5 //dialog title

Most Scored Player
1. Empty Slot: 0
2. Empty Slot: 0
3. Empty Slot: 0
4. Empty Slot: 0
5. Empty Slot: 0

Most Killer Player
1. Empty Slot: 0
2. Empty Slot: 0
3. Empty Slot: 0
4. Empty Slot: 0
5. Empty Slot: 0

Close //close the dialog

Reply
#2

Any help or idea? Thanks!
Reply
#3

first you need to create a saving system which saves kills too and then put the kills code in the dialog
Reply
#4

I'm still looking for a clear answer. thanks!

Edit: and from the guy abover me. Yes I had it already.

Код:
    #if USE_MYSQL == true
	new query[800];
 	format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `XPos` = %.2f, `YPos` = %.2f, `ZPos` = %.2f, `AdminLevel` = %d, `VIPLevel` = %d, `WantedLevel` = %d, \
	`Kills` = %d, `Deaths` = %d, `Money` = %d, `Score` = %d, `Health` = %.2f, `Armour` = %.2f, `Hours` = %d, `Minutes` = %d, `Seconds` = %d, `LastSkin` = %d, `KickCount` = %d, `SpawnCount` = %d, `ReportCount` = %d, `Warnings` = %d, `FailLogin` = %d, `RconAttempt` = %d \
	WHERE `PlayerName` = '%s'",
		POS[0],
		POS[1],
		POS[2],
		PlayerInfo[playerid][AdminLevel],
		PlayerInfo[playerid][VIPLevel],
		GetPlayerWantedLevel(playerid),
		PlayerInfo[playerid][Kills],
		PlayerInfo[playerid][Deaths],
		GetPlayerMoney(playerid),
		GetPlayerScore(playerid),
		health,
		armour,
		h,
		m,
		s,
		PlayerInfo[playerid][LastSkin],
		PlayerInfo[playerid][KickCount],
		PlayerInfo[playerid][SpawnCount],
		PlayerInfo[playerid][ReportCount],
		PlayerInfo[playerid][Warnings],
		PlayerInfo[playerid][FailLogin],
		PlayerInfo[playerid][RconAttempt],
		GetName(playerid));
Reply
#5

pawn Код:
CMD:top(playerid, params[])
{
    mysql_query("SELECT `Score`, `Playername` FROM `#MYSQL_TABLE` ORDER BY `Score` DESC LIMIT 10");
    mysql_store_result();

    new
        ID,
        output[800];

    while(mysql_retrieve_row())
    {
        ID ++;

        new
            Name[24],
            scorevariable[80];

        mysql_fetch_field_row(Name, "Name");
        mysql_fetch_field_row(scorevariable, "pScore");

        format(output, sizeof(output), "%s%d. %s %d Score\n", output, ID, Name, strval(scorevariable));
    }
    mysql_free_result();

    ShowPlayerDialog(playerid, DIALOG_TOP, DIALOG_STYLE_MSGBOX, "Top 10 Players", output, "OK", "");
    return 1;
}
Reply
#6

Quote:
Originally Posted by Sands
Посмотреть сообщение
pawn Код:
CMD:top(playerid, params[])
{
    mysql_query("SELECT `Score`, `Playername` FROM `#MYSQL_TABLE` ORDER BY `Score` DESC LIMIT 10");
    mysql_store_result();

    new
        ID,
        output[800];

    while(mysql_retrieve_row())
    {
        ID ++;

        new
            Name[24],
            scorevariable[80];

        mysql_fetch_field_row(Name, "Name");
        mysql_fetch_field_row(scorevariable, "pScore");

        format(output, sizeof(output), "%s%d. %s %d Score\n", output, ID, Name, strval(scorevariable));
    }
    mysql_free_result();

    ShowPlayerDialog(playerid, DIALOG_TOP, DIALOG_STYLE_MSGBOX, "Top 10 Players", output, "OK", "");
    return 1;
}
Thanks for the reply but exactly what is this for? I already have this top score if you READ my first post. I just want to add another board for Top Kills Player in the same dialog.

and
Код:
mysql_query
will not work. Coz i'm using R7.
Reply
#7

then combine this with your first script and add both of them in a single dialog.
Reply
#8

Quote:
Originally Posted by Sands
Посмотреть сообщение
then combine this with your first script and add both of them in a single dialog.
Combine this? You mean what you've posted, another score board for score? Have you not READ MY FIRST POST? I ALREADY HAVE A SCORE BOARD and you gave me another score board SAME but different procedure. And I think you din't even read what you posted.

Sorry if i'm being too harsh.
Reply
#9

Try this:
pawn Код:
// put this at the top
new gTops[2][512];

forward TopPlayers(playerid);
public TopPlayers(playerid)
{
    new rows, fields, name[MAX_PLAYER_NAME], score[20], gscore;

    cache_get_data(rows, fields);

    if(rows > 0)
    {
        for(new i = 0; i < 10; i++)
        {
            cache_get_field_content(i, "Score", score);
            gscore = strval(score);

            if(gscore != 0) cache_get_field_content(i, "PlayerName", name);

            format(gTops[0], sizeof(gTops[]), "%s%d. %s: %d\n", gTops[0], i + 1, (gscore == 0) ? ("Slot Empty") : (name), gscore);
        }
    }

    format(gTops[0], sizeof(gTops[]), "Most Scored Player\n%s", gTops[0]);

    mysql_function_query(gSQL, "SELECT `Kills`, `PlayerName` FROM `"#MYSQL_TABLE"` ORDER BY `Kills` DESC LIMIT 10", true, "ShowTop", "d", playerid);
    return 1;
}

forward ShowTop(playerid);
public ShowTop(playerid)
{
    new rows, fields, name[MAX_PLAYER_NAME], kills[20], gkills;

    cache_get_data(rows, fields);

    if(rows > 0)
    {
        for(new i = 0; i < 10; i++)
        {
            cache_get_field_content(i, "Kills", kills);
            gkills = strval(kills);

            if(gkills != 0) cache_get_field_content(i, "PlayerName", name);

            format(gTops[1], sizeof(gTops[]), "%s%d. %s: %d\n", gTops[1], i + 1, (gkills == 0) ? ("Slot Empty") : (name), gkills);
        }
    }

    format(gTops[1], sizeof(gTops[]), "Most Killer Player\n%s", gTops[1]);

    new str[1024];

    format(str, sizeof(str), "%s\n\n\n%s", gTops[0], gTops[1]);
    ShowPlayerDialog(playerid, 1223, DIALOG_STYLE_MSGBOX, "Top 10", str, "Close");
    return 1;
}
Maybe all that could be simplified by just 1 query, but too lazy to figure it out how, but ^ should do the trick though.
Reply
#10

Quote:
Originally Posted by -Prodigy-
Посмотреть сообщение
Try this:
pawn Код:
// put this at the top
new gTops[2][512];

forward TopPlayers(playerid);
public TopPlayers(playerid)
{
    new rows, fields, name[MAX_PLAYER_NAME], score[20], gscore;

    cache_get_data(rows, fields);

    if(rows > 0)
    {
        for(new i = 0; i < 10; i++)
        {
            cache_get_field_content(i, "Score", score);
            gscore = strval(score);

            if(gscore != 0) cache_get_field_content(i, "PlayerName", name);

            format(gTops[0], sizeof(gTops[]), "%s%d. %s: %d\n", gTops[0], i + 1, (gscore == 0) ? ("Slot Empty") : (name), gscore);
        }
    }

    format(gTops[0], sizeof(gTops[]), "Most Scored Player\n%s", gTops[0]);

    mysql_function_query(gSQL, "SELECT `Kills`, `PlayerName` FROM `"#MYSQL_TABLE"` ORDER BY `Kills` DESC LIMIT 10", true, "ShowTop", "d", playerid);
    return 1;
}

forward ShowTop(playerid);
public ShowTop(playerid)
{
    new rows, fields, name[MAX_PLAYER_NAME], kills[20], gkills;

    cache_get_data(rows, fields);

    if(rows > 0)
    {
        for(new i = 0; i < 10; i++)
        {
            cache_get_field_content(i, "Kills", kills);
            gkills = strval(kills);

            if(gkills != 0) cache_get_field_content(i, "PlayerName", name);

            format(gTops[1], sizeof(gTops[]), "%s%d. %s: %d\n", gTops[1], i + 1, (gkills == 0) ? ("Slot Empty") : (name), gkills);
        }
    }

    format(gTops[1], sizeof(gTops[]), "Most Killer Player\n%s", gTops[1]);

    new str[1024];

    format(str, sizeof(str), "%s\n\n\n%s", gTops[0], gTops[1]);
    ShowPlayerDialog(playerid, 1223, DIALOG_STYLE_MSGBOX, "Top 10", str, "Close");
    return 1;
}
Maybe all that could be simplified by just 1 query, but too lazy to figure it out how, but ^ should do the trick though.
Wow dude. You make it right to show the top 10 kills but why. Everytime I use /top it duplicates another one inside the dialog. I tried to do /top 4 times and as you can see Most Killer Player shows 4 times. Here is the sample pic.

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)