21.10.2018, 14:13
Hi. When I type /reports it shows that "There are no Reports" but at MySQL there are 6 reports.
Why?
Mysql rows are: ID, Username, Targetname, Data, Report,
Why?
PHP код:
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;
}