CMD:reports(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid,-1,""COL_RED"Nu detii functia administrativa necesara!");
mysql_tquery(handle, "SELECT * FROM `reportlog`", "ShowReports", "d", playerid);
ShowPlayerDialog(playerid, DIALOG_REPORTS, DIALOG_STYLE_TABLIST_HEADERS, "Caption",
"Header 1\tHeader 2\tHeader 3\tHeader 4\n\
Item 1 Column 1\tItem 1 Column 2\tItem 1 Column 3\tItem 1 Column 4\n\
{FF0000}Item 2 Column 1\t{33AA33}Item 2 Column 2\tItem 2 Column 3\tItem 2 Column 4",
"Button 1", "Button 2");
return 1;
}
#define DIALOG_UNUSED 1
CMD:reports(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid,-1,""COL_RED"Not Admin!");
mysql_tquery(mysql, "SELECT * FROM `reportlog`", "ShowReports", "d", playerid);
return 1;
}
forward ShowReports(playerid);
public ShowReports(playerid)
{
new rows, fields, handlingarray[500];
cache_get_data(rows, fields, handle);
if(rows != 0)
{
strcat(handlingarray, "Username\t\tTargetname\t\tReason\t\tDate");
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), "%s\t\t%s\t\t%s\t\t%s", reporter, reported, reportreason, reportdon);
strcat(handlingarray, showreps);
}
ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_TABLIST_HEADERS, "Reports", handlingarray, "OK", "");
}
else if(rows == 0)
{
SendClientMessage(playerid, RED, "There are currently no reports!");
}
return 1;
}
{
strcat(handlingarray, "ID\tUsername\t\tTargetname\t\tReason\t\tDate");
format(showreps, sizeof(showreps), "%i\t%s\t\t%s\t\t%s\t\t%s",reportid, reporter, reported, reportreason, reportedon);
forward ShowReports(playerid);
public ShowReports(playerid)
{
new rows, fields, handlingarray[500];
cache_get_data(rows, fields, handle);
if(rows != 0)
{
strcat(handlingarray, "ID\tUsername\t\tTargetname\t\tReason\t\tDate\n");
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), "%i\t%s\t\t%s\t\t%s\t\t%s\n", reportid, reporter, reported, reportreason, reportdon);
strcat(handlingarray, showreps);
}
ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_TABLIST_HEADERS, "Reports", handlingarray, "OK", "");
}
else if(rows == 0)
{
SendClientMessage(playerid, RED, "There are currently no reports!");
}
return 1;
}
sorry did silly mistake forgot "\n"
pawn Код:
|
mysql_tquery(mysql, "SELECT * FROM `reportlog`", "ShowReports", "d", playerid);
mysql_tquery(mysql, "SELECT * FROM `reportlog` ORDER BY ID DESC LIMIT 100", "ShowReports", "d", playerid);
CMD:acceptreport(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid,-1,""COL_RED"Not Admin!");
new str[128], Cache:delrep, repid;
if(sscanf(params, "i", repid)) return SendClientMessage(playerid, -1, "Usage: /acceptreport [Report ID]");
mysql_format(handle, str, sizeof(str), "SELECT * FROM `reportlog` WHERE `ID` = '%d'", repid);
delrep = mysql_query(handle, str, true);
new count = cache_num_rows();
if(count > 0)
{
mysql_format(handle, str, sizeof(str), "DELETE FROM `reportlog` WHERE `ID` = '%d'", repid);
mysql_query(handle, str, false);
format(str, sizeof(str), "You have accepted the report ID: [#%d]", repid);
SendClientMessage(playerid, COLOR_YELLOW, str);
}
else return SendClientMessage(playerid, COLOR_YELLOW, "Report ID not valide!");
cache_delete(delrep);
return 1;
}
You have accepted the report ID: %d from user: %s
new tmpName[MAX_PLAYER_NAME]; cache_get_field_content(0, "Username", tmpName, handle, MAX_PLAYER_NAME);
You'd have to fetch the Username and store it in a variable before you delete the row.
Код:
new tmpName[MAX_PLAYER_NAME]; cache_get_field_content(0, "Username", tmpName, handle, MAX_PLAYER_NAME); (parameters on the cache_get_field_content might be slightly incorrect as i'm not familiar with the version of mysql you're using) |
SendClientMessage(tmpName, COLOR_YELLOW, str2);