21.10.2018, 14:29
Had you been using r41 this should work:
You may be able to adapt this to work with your version (btw i'd recommend learning to use LIMIT in your queries that could potentially yield thousands of rows to avoid a database hiccup).
Код:
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; }