22.11.2013, 13:17
Hi,
I'm not sure why string2 isn't printing in the client message as it should be the value of 'kills'.
It's pretty messy code at the moment so don't criticize me on that, I'm just trying to get the first part to work, tia
Looks like this, but the Kill value isn't printing
"1. Hitler Amount (16)"
"2. Frank Amount (12)"
"3. outlawz Amount (5)"
I'm not sure why string2 isn't printing in the client message as it should be the value of 'kills'.
It's pretty messy code at the moment so don't criticize me on that, I'm just trying to get the first part to work, tia
Code:
COMMAND:top(playerid,params[]) { new string[64], string2[64], query[128], DBResult:result; DBResult:result2; format(query,sizeof(query),"SELECT `Name` FROM `USERS` ORDER BY (`KILLS` * 1) DESC limit 3"); result = db_query(Database,query); for(new a;a<db_num_rows(result);a++) { db_get_field(result,0,string,128); format(query,sizeof(query),"SELECT `KILLS` FROM `USERS` WHERE `Name` = lower('%s')",string); result2 = db_query(Database,query); db_get_field(result2,0,string2,128); format(string,sizeof(string),"%d. %s Amount (%d)",a+1,string, string2); SendClientMessage(playerid,-1,string); db_next_row(result); db_free_result(result2); } db_free_result(result); return 1; }
"1. Hitler Amount (16)"
"2. Frank Amount (12)"
"3. outlawz Amount (5)"