CMD:reports(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid,-1,""COL_RED"Not Admin!");
new str[128], Cache:reports;
mysql_format(mysql, str, sizeof(str), "SELECT * FROM `reportlog`");
reports = mysql_query(mysql, str, true);
new count = cache_num_rows();
if(count > 0)
{
SendClientMessage(playerid, -1, "Reports:");
for(new i = 0; i < count; i++)
{
new reporter[25], reported[25], reportid, reportedon[25], reportreason[25], showreps[450];
reportid = cache_get_field_content_int(i, "ID");
cache_get_field_content(i, "Username", reporter);
cache_get_field_content(i, "Targetname", reported);
cache_get_field_content(i, "Data", reportedon);
cache_get_field_content(i, "Report", reportreason);
format(showreps, sizeof(showreps), "[#%d] (%s) %s has reported %s! [Reason: %s]", reportid, reportedon, reporter, reported, reportreason);
SendClientMessage(playerid, RED, showreps);
}
}
else return SendClientMessage(playerid, RED, "There are currently no reports!");
cache_delete(reports);
return 1;
}
CMD:reports(playerid, params[]) { if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid,-1,""COL_RED"Not Admin!"); new str[128]; mysql_format(mysql, str, sizeof(str), "SELECT * FROM `reportlog`"); mysql_tquery(mysql, str, "ShowReports", "u", playerid); return 1; } forward ShowReports(playerid); public ShowReports(playerid) { if(cache_get_row_count() > 0) { SendClientMessage(playerid, -1, "Reports:"); for(new i = 0; i < count; i++) { new reporter[25], reported[25], reportid, reportedon[25], reportreason[25], showreps[450]; reportid = cache_get_field_content_int(i, "ID"); cache_get_field_content(i, "Username", reporter); cache_get_field_content(i, "Targetname", reported); cache_get_field_content(i, "Data", reportedon); cache_get_field_content(i, "Report", reportreason); format(showreps, sizeof(showreps), "[#%d] (%s) %s has reported %s! [Reason: %s]", reportid, reportedon, reporter, reported, reportreason); SendClientMessage(playerid, RED, showreps); } } else return SendClientMessage(playerid, RED, "There are currently no reports!"); return 1; }
Had you been using r41 this should work:
Код:
CMD:reports(playerid, params[]) { if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid,-1,""COL_RED"Not Admin!"); new str[128]; mysql_format(mysql, str, sizeof(str), "SELECT * FROM `reportlog`"); mysql_tquery(mysql, str, "ShowReports", "u", playerid); return 1; } forward ShowReports(playerid); public ShowReports(playerid) { if(cache_get_row_count() > 0) { SendClientMessage(playerid, -1, "Reports:"); for(new i = 0; i < count; i++) { new reporter[25], reported[25], reportid, reportedon[25], reportreason[25], showreps[450]; reportid = cache_get_field_content_int(i, "ID"); cache_get_field_content(i, "Username", reporter); cache_get_field_content(i, "Targetname", reported); cache_get_field_content(i, "Data", reportedon); cache_get_field_content(i, "Report", reportreason); format(showreps, sizeof(showreps), "[#%d] (%s) %s has reported %s! [Reason: %s]", reportid, reportedon, reporter, reported, reportreason); SendClientMessage(playerid, RED, showreps); } } else return SendClientMessage(playerid, RED, "There are currently no reports!"); return 1; } |
new str[128], Cache:reports;
mysql_format(mysql, str, sizeof(str), "SELECT * FROM `reportlog`");
reports = mysql_query(mysql, str, true);
new count = cache_num_rows();
new Cache:reports = mysql_query(mysql, "SELECT * FROM `reportlog`", true); //you really don tneed to use format
new count = cache_num_rows(mysql); //forgot handle
CMD:reports(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid,-1,""COL_RED"Not Admin!");
new Cache:reports = mysql_query(mysql, "SELECT * FROM `reportlog`", true);
new rows = cache_num_rows(mysql), count = 0;
SendClientMessage(playerid, -1, "Reports:");
for(new i = 0; i < rows; i++)
{
new reporter[MAX_PLAYER_NAME], reported[MAX_PLAYER_NAME], reportid, reportedon[25], reportreason[25], showreps[200];
reportid = cache_get_field_content_int(i, "ID");
cache_get_field_content(i, "Username", reporter);
cache_get_field_content(i, "Targetname", reported);
cache_get_field_content(i, "Data", reportedon);
cache_get_field_content(i, "Report", reportreason);
format(showreps, sizeof(showreps), "[#%d] (%s) %s has reported %s! [Reason: %s]", reportid, reportedon, reporter, reported, reportreason);
SendClientMessage(playerid, RED, showreps);
count++;
}
if(count == 0)
{
SendClientMessage(playerid, RED, "There are currently no reports!");
}
cache_delete(reports);
return 1;
}
if it is storing data in ur database, then this should work
otherwise, there might be errors in ur logs |