22.11.2013, 13:37
That should work:
pawn Code:
COMMAND:top( playerid, params[ ] )
{
new
string[ 44 ],
info[ 2 ][ MAX_PLAYER_NAME ],
DBResult: result
;
result = db_query( Database, "SELECT Name, KILLS FROM USERS ORDER BY KILLS DESC LIMIT 3" );
for( new a; a != db_num_rows( result ); a++ )
{
db_get_field( result, 0, info[ 0 ], MAX_PLAYER_NAME );
db_get_field( result, 1, info[ 1 ], 7 );
format( string, sizeof( string ), "%d. %s Amount (%d)", a + 1, info[ 0 ], strval( info[ 1 ] ) );
SendClientMessage( playerid, -1, string );
db_next_row( result );
}
db_free_result( result );
return 1;
}