// Blacksmith ranking list
query_sql "SELECT `fame`,`name` FROM `char` WHERE `fame`>0 AND (`class`='10' OR `class`='4011' OR `class`='4033' OR `class`='4058' OR `class`='4064' OR `class`='4100') ORDER BY `fame` DESC LIMIT 0,3", .@fame, .@name);
for( set .@i,0; .@i < 3; set .@i,.@i + 1 )
{
mes "Top 3 Blacksmiths";
mes .@i + 1 + ". " + .@name + " with fame of: " + .@fame + ".";
}
// Alchemist ranking list
query_sql "SELECT `fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='18' OR `class`='4019' OR `class`='4041' OR `class`='4071' OR `class`='4078' OR `class`='4107') ORDER BY `fame` DESC LIMIT 0,3", .@fame, .@name);
for( set .@i,0; .@i < 3; set .@i,.@i + 1 )
{
mes "Top 3 Blacksmiths";
mes .@i + 1 + ". " + .@name + " with fame of: " + .@fame + ".";
}
That prints out the top 3 Blacksmith and Alchemist classes from the fame list. You can do whatever you want with it from there. The two important parts are the queries.