PDA

View Full Version : dialog problem


PowerF
18/08/2015, 07:29 AM
COMMAND:topxp(playerid, params[])
{
new p_top[24],score,string[600],row[600];
mysql_query("SELECT playerName, playerXP FROM playerdata ORDER BY playerXP DESC Limit 10");
mysql_store_result();
mysql_fetch_row(row);
sscanf(row, "p<|>s[600]d",p_top,score);
format(string, sizeof string, "Top Player: %s | XP: %d",p_top,score);
mysql_free_result();
ShowPlayerDialog(playerid, 108, DIALOG_STYLE_MSGBOX,"Top Player", string, "Close", "");
return 1;
}

its just showing 1 player..

LetsOWN[PL]
18/08/2015, 10:59 AM
COMMAND:topxp(playerid, params[])
{
new p_top[24],score,string[600],row[600];
mysql_query("SELECT playerName, playerXP FROM playerdata ORDER BY playerXP DESC Limit 10");
mysql_store_result();
mysql_fetch_row(row);
sscanf(row, "p<|>s[600]d",p_top,score);
format(string, sizeof string, "Top Player: %s | XP: %d",p_top,score);
mysql_free_result();
ShowPlayerDialog(playerid, 108, DIALOG_STYLE_MSGBOX,"Top Player", string, "Close", "");
return 1;
}

its just showing 1 player..
Try

new p_top[24],score,string[600],row[600];

mysql_query("SELECT playerName, playerXP FROM playerdata ORDER BY playerXP DESC Limit 10");
mysql_store_result();

while( mysql_fetch_row(row) ) {
sscanf(row, "p<|>s[600]d",p_top,score);
format(string, sizeof string, "%sTop Player: %s | XP: %d", string, p_top,score);
}

mysql_free_result();
ShowPlayerDialog(playerid, 108, DIALOG_STYLE_MSGBOX,"Top Players", string, "Close", "");
return 1;

PowerF
18/08/2015, 02:04 PM
its shown but,the dialog are just so long like weird..,i tryed to use /n but still failed

Beckett
18/08/2015, 02:07 PM
new p_top[24],score,string[600],row[600];

mysql_query("SELECT playerName, playerXP FROM playerdata ORDER BY playerXP DESC Limit 10");
mysql_store_result();

while( mysql_fetch_row(row) ) {
sscanf(row, "p<|>s[600]d",p_top,score);
format(string, sizeof string, "%sTop Player: %s | XP: %d\n", string, p_top,score);
}

mysql_free_result();
ShowPlayerDialog(playerid, 108, DIALOG_STYLE_MSGBOX,"Top Players", string, "Close", "");
return 1;


This code isn't mine, it's LetsOWN[PL] but I've edited it. Tell me if it works fine?

PowerF
18/08/2015, 02:13 PM
THANKS!

+REP for you both :3

PowerF
18/08/2015, 02:18 PM
But How do i make like this.

1)greatm8 || XP:696969

(adding number)

LetsOWN[PL]
20/08/2015, 10:13 PM
But How do i make like this.

1)greatm8 || XP:696969

(adding number)

new p_top[24],score,string[600],row[600];

mysql_query("SELECT playerName, playerXP FROM playerdata ORDER BY playerXP DESC Limit 10");
mysql_store_result();

new Count = 1;
while( mysql_fetch_row(row) ) {
sscanf(row, "p<|>s[600]d",p_top,score);
format(string, sizeof string, "%s%d) Top Player: %s | XP: %d\n", string, Count, p_top,score);
Count++;
}

mysql_free_result();
ShowPlayerDialog(playerid, 108, DIALOG_STYLE_MSGBOX,"Top Players", string, "Close", "");
return 1;