Need top 10 mysql +rep
#1

need top 10 rank mysql

mysql version r39-2

+rep
Reply
#2

pawn Код:
mysql_tquery( mysql, "SELECT username, rank FROM `your database` ORDER BY `rank` DESC LIMIT 20", "LoadTopRank", "", "" );
This query will load the top 10 players, if you want to show them on dialog you should loop the rows.
pawn Код:
forward LoadTopRank( );
public LoadTopRank( )
{
    new
        name[24], rank, str[ 512 ];
    for(new i =0; i < cache_num_rows(); i++)
    {
        cache_get_field_content(i, "username", name, mysql, 24);
        kills = cache_get_field_content_int(i,"rank");
        deaths = cache_get_field_content_int(i,"deaths");
        format( str, sizeof( str ) , "%s %i) %s %i", str, i+1, name, rank);
    }
    ShowPlayerDialog( playerid, 2121, DIALOG_STYLE_MSGBOX,"Top",str, "Close","" );
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)