09.07.2012, 08:03
Hi guys! Can somebody help pe to transform this Clan Top from SQL into MySQL?
REP++;
![Cheesy](images/smilies/biggrin.png)
pawn Код:
ShowTopClan( playerid, stats[ ], what[ ], limit = MAX_TOP_LIMIT ) // THX to Zh3r0 & Roach_
{
new Speed = GetTickCount( ),
DialString[ 3_000 ],
String[ 2 ][ 256 ],
Query[ 2 ][ 256 ],
DBResult:Result1,
cColor[ 12 ] = ""W"";
g_dbKeptAlive = db_open( "CSystem.db" ); //Open DB
format( Query[ 0 ], 256, "SELECT `clanname` FROM `clans` ORDER BY (`%s` * 1) DESC limit %d", stats, limit);
Result1 = db_query( g_dbKeptAlive, Query[ 0 ] );
format( DialString, sizeof DialString, ""W"More info about our "G"Clan System "W"find on: "YE"(/chelp)\n\n\n"W"See here "O"TOP Clans "W"ordered by"S": "YE"%s\n", what);
for( new Qr; Qr < db_num_rows( Result1 ); Qr ++ )
{
db_get_field( Result1, 0, String[ 0 ], 256 );
format( Query[ 1 ], 256, "SELECT `%s` FROM `clans` WHERE `clanname` = '%s'", stats, String[ 0 ] );
new DBResult:Result2 = db_query( g_dbKeptAlive, Query[ 1 ] );
db_get_field( Result2, 0, String[ 1 ], 256 );
format( DialString, sizeof DialString, "%s\n"C_R"%d."C_FG" %s "C_W": %s%s", DialString, Qr + 1, String[ 0 ], cColor, FormatNumber( strval( String[ 1 ] ) ) );
db_next_row( Result1 );
db_free_result( Result2 );
}
db_free_result( Result1 );
format( DialString, sizeof DialString, "%s\n\n"W"Top list generated in "C_FG"%d "W"ms.", DialString, GetTickCount( ) - Speed );
ShowPlayerDialog( playerid, Nothing, DIALOG_STYLE_MSGBOX, ""W"Location: "G"TOP Clans", DialString, "(Close)", "" );
return ( 1 );
}