Quote:
Originally Posted by Jefff
pawn Код:
CMD:topstat(playerid,params[]) { SendClientMessage(playerid,COLOR_GREEN,"Top X Y'ers"); new DBResult:result, a, string[128], exp[20]; format(string,sizeof(string),"SELECT `Username`, `EXP` FROM `users` ORDER BY `EXP` DESC LIMIT 5"); result = db_query(Database,string); if(db_num_rows(result)) { do { db_get_field(result,0,string,25); db_get_field(result,1,exp,sizeof(exp)); format(string,sizeof(string),"%d. %s Stat: %s",++a,string,exp); SendClientMessage(playerid,COLOR_ORANGE,string); } while(db_next_row(result)); } db_free_result(result); return 1; }
|
Thanks friend, but I had to do this to give me the top correctly
pawn Код:
format(string,sizeof(string),"SELECT `Username`, `EXP` FROM `users` ORDER BY (`EXP` * 1) DESC LIMIT 5");
I had ('EXP` *1) because without it it'll look at it as if it's a string, timing it by 1 will turn it into a number.