do it like this:
Код:
new string[256], rows, query[256];
if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorized to use this command.");
mysql_format(Database, query, sizeof(query), "SELECT * FROM `reports`");
mysql_query(Database, query);
cache_get_row_count(rows);
new name[256], reason[128];
for(new index = 0; index < rows; index++)
{
cache_get_value_name(index, "Username", name);
cache_get_value_name(index, "Reason", reason);
SendClientMessage(playerid, -1, " ");
SendClientMessage(playerid, -1, "{33CCFF}:::::::::: {FFFFFF}Report List {33CCFF}::::::::::");
format(string,sizeof(string), "Username: %s | Reason: %s", name, reason);
SendClientMessage(playerid, -1, string);
SendClientMessage(playerid, -1, " ");
}
if(rows <= 0)
{
SendClientMessage(playerid, -1, " ");
SendClientMessage(playerid, -1, "{33CCFF}:::::::::: {FFFFFF}Report List {33CCFF}::::::::::");
SendClientMessage(playerid, COLOR_ORANGE, "Report list is currently empty.");
SendClientMessage(playerid, -1, " ");
}
this should work
if this doesn't work then show us your output and reports table, and make sure there are reports in the table, if there are no reports then it wont work so first check your table again.
edit:
also why do you have \r\n in SendClientMessage? it wouldnt make difference because \r nor \n work in SendClientMessage
change that line to format(string,sizeof(string), "Username: %s | Reason: %s", name, reason);
secondly you also have %s for string, why are you sending the string again? this would just 2x the amount of reports and display duplicate messages.
I dont know what you are trying to accomplish with those messages here.