Top10 Dont Work [Help Me?]
#1

Код:
CMD:top10(playerid, params[])
{
	format(qry, sizeof qry, "SELECT `username` FROM `players` ORDER BY `score` DESC LIMIT 10");
	mysql_function_query(dbHandle, qry, true, "", "");
	new num;
	new top10[10][24], stringSkor[556];
	while(mysql_retrieve_row())
	{
	    mysql_fetch_field_row(top10[num], "username");
	    num++;
	}
	mysql_free_result();
	format(stringSkor, sizeof stringSkor, """1~\t\t""%s\n""2~\t\t""%s\n""3~\t\t""%s\n""4~\t\t""%s\n""5~\t\t""%s\n""6~\t\t""%s\n""7~\t\t""%s\n""8~\t\t""%s\n""9~\t\t""%s\n""10~\t\t""%s", top10[0], top10[1], top10[2], top10[3], top10[4], top10[5], top10[6], top10[7], top10[8], top10[9]);
	//ShowPlayerDialog(playerid, DIALOG_TOPLIST, DIALOG_STYLE_MSGBOX, ""pd"Top 10 Skor", stringSkor, "Kapat", "");
	ShowPlayerDialog(playerid,20,DIALOG_STYLE_MSGBOX,"{E34234}<!> {ffffff}TopScore {E34234}<!>",stringSkor[0],"Tamam","");
    return 1;
}
Scores not showing entered command
Reply
#2

top10[0], GetPlayerScore(playerid) and %d(integer)
Reply
#3

Quote:
Originally Posted by ProRakNet
Посмотреть сообщение
top10[0], GetPlayerScore(playerid) and %d(integer)
You should be more descriptive.very difficult to understand something here
Reply
#4

you didnt use any specifier to show the players score
Reply
#5

Quote:
Originally Posted by ProRakNet
Посмотреть сообщение
top10[0], GetPlayerScore(playerid) and %d(integer)
Never knew GetPlayerScore worked for offline players!

@OP:
Get the player's score from the MySQL Table and then use %d to print it out.
Reply
#6

Код:
mysql_function_query(database, "SELECT * FROM `members` ORDER BY `score` DESC LIMIT 10", true, "ShowTop", "d", playerid);
Код:
forward ShowTop(playerid);
public ShowTop(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields, database); 
    if(!rows) return true;
    new szName[MAX_PLAYER_NAME],score[13];
    new page[924];
    page = "{8DF800}Rank\n{8DF800}Nickname\n{8DF800}Score\n";
    for(new i = 0; i < rows; i++)
    {
        cache_get_field_content(i, "Nick", szName, database);
        cache_get_field_content(i, "score", score, database);
        format(page, 2024, "%s{FFFFFF}%d\t%s\t%d\n", page, (i+1), szName, strval(score));
    }
    ShowPlayerDialog(playerid,0,DIALOG_STYLE_TABLIST_HEADERS,"Top Players",page,"ОК","");
    return 1;
}
Reply
#7

Quote:
Originally Posted by Stuntff
Посмотреть сообщение
Код:
mysql_function_query(database, "SELECT * FROM `members` ORDER BY `score` DESC LIMIT 10", true, "ShowTop", "d", playerid);
Код:
forward ShowTop(playerid);
public ShowTop(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields, database); 
    if(!rows) return true;
    new szName[MAX_PLAYER_NAME],score[13];
    new page[924];
    page = "{8DF800}Rank\n{8DF800}Nickname\n{8DF800}Score\n";
    for(new i = 0; i < rows; i++)
    {
        cache_get_field_content(i, "Nick", szName, database);
        cache_get_field_content(i, "score", score, database);
        format(page, 2024, "%s{FFFFFF}%d\t%s\t%d\n", page, (i+1), szName, strval(score));
    }
    ShowPlayerDialog(playerid,0,DIALOG_STYLE_TABLIST_HEADERS,"Top Players",page,"ОК","");
    return 1;
}
But,i need command version
Reply
#8

just change it to command
Like this
PHP код:
CMD:top(playerid,params[])
{
new 
rowsfields;
mysql_function_query(database"SELECT * FROM `members` ORDER BY `score` DESC LIMIT 10"true"ShowTop""d"playerid);
cache_get_data(rowsfieldsdatabase); 
    if(!
rows) return true;
    new 
szName[MAX_PLAYER_NAME],score[13];
    new 
page[924];
    
page "{8DF800}Rank\n{8DF800}Nickname\n{8DF800}Score\n";
    for(new 
0rowsi++)
    {
        
cache_get_field_content(i"Nick"szNamedatabase);
        
cache_get_field_content(i"score"scoredatabase);
        
format(page2024"%s{FFFFFF}%d\t%s\t%d\n"page, (i+1), szNamestrval(score));
    }
    
ShowPlayerDialog(playerid,0,DIALOG_STYLE_TABLIST_HEADERS,"Top Players",page,"ОК","");
return 
1;

Note: i didnt test it if you found any prob tell me
Reply
#9

And change
Код:
format(page, 2024, "%s{FFFFFF}%d\t%s\t%d\n", page, (i+1), szName, strval(score));
to
Код:
format(page, 924, "%s{FFFFFF}%d\t%s\t%d\n", page, (i+1), szName, strval(score));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)