SELECT * FROM `reportLog` LIMIT 0, 15
CMD:reports(playerid, params[])
{
if(pStats[playerid][pAdmin] < 1)
return 1;
new szQuery[200], iStart = 0, iEnd = 15;
format(szQuery, sizeof(szQuery), "SELECT * FROM `reportsLog` LIMIT %d, %d", iStart, iEnd");
mysql_function_query(1, szQuery, true, "thread_LoadReports", "d", playerid);
return 1;
}
forward thread_LoadReports(playerid);
public thread_LoadReports(playerid)
{
new rows, fields;
cache_get_data(rows, fields);
if(rows)
{
CMD:reports(playerid, params[])
{
if(pStats[playerid][pAdmin] < 1)
return 1;
new szQuery[96], iStart = 0, iEnd = 15;
format(szQuery, sizeof(szQuery), "SELECT * FROM `reportsLog` LIMIT %d, %d", iStart, iEnd);
mysql_function_query(1, szQuery, true, "thread_LoadReports", "d", playerid);
return 1;
}
forward thread_LoadReports(playerid);
public thread_LoadReports(playerid)
{//place your ConnectionHandle var
new row, rows, fields, dest[144], BigVar[1024]; // is 144 the max report length? it's a dialog right? so you might need a large string length
cache_get_data(rows, fields);
if(rows > 0)
{
while(row < rows)
{
cache_get_row(row, 0, dest, ConnectionHandle);
format(BigVar, sizeof(BigVar), "Report ID [%d]: %s", row, dest);
++row;
}
ShowPlayerDialog(playerid, dialogid, MSGORLIST?, "Report Log", BigVar, "Select", "Close");
}
else
{
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, "Report Log", "There are no reports in this criteria", "Close", "");
}
return 1;
}
reportID, reporterUsername, reportedUsername, reportReason, reportTimestamp
[reportID] | [reportedUsername] [reportReason] |
CMD:reports(playerid, params[])
{
if(pStats[playerid][pAdmin] < 1) return 1;
new szQuery[96], iStart = 0, iEnd = 15;
format(szQuery, sizeof(szQuery), "SELECT `reportID`, `reportedUsername`, `reportReason` FROM `reportsLog` LIMIT %d, %d", iStart, iEnd);
mysql_function_query(1, szQuery, true, "thread_LoadReports", "d", playerid);
SetPVarInt(playerid, "pReport_Start", iStart);
return 1;
}
forward thread_LoadReports(playerid);
public thread_LoadReports(playerid)
{//place your ConnectionHandle var
new row, rows, fields, reportid, username[MAX_PLAYER_NAME], dest[64], BigVar[512]; // you might need a large string length
cache_get_data(rows, fields);
if(rows > 0)
{
while(row < rows)
{
cache_get_row(row, 0, dest, ConnectionHandle); // fix the connection handle
reportid = strval(dest);
cache_get_row(row, 1, username, ConnectionHandle);
cache_get_row(row, 2, dest, ConnectionHandle);
format(BigVar, sizeof(BigVar), "[%d] [%s]: %s", row, username, dest);
++row;
}
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LISTITEM, "Report Log", BigVar, "Select", "Close");
}
else
{
DeletePVar(playerid, "pReport_Start");
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, "Report Log", "There are no reports in this criteria", "Close", "");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case dialogid:
{
if(!response)
{
DeletePVar(playerid, "pReport_Start");
// put your shit here
return 1;
}
new szQuery[96];
format(szQuery, sizeof(szQuery), "SELECT * FROM `reportsLog` WHERE `reportID` = %d LIMIT 0, 1", GetPVarInt(playerid, "pReport_Start") + listitem);
mysql_function_query(1, szQuery, true, "thread_LoadReportInformation", "d", playerid);
}
}
return 1;
}
forward thread_LoadReportInformation(playerid);
public thread_LoadReportInformation(playerid)
{
new rows, fields, reportid, username_er[MAX_PLAYER_NAME],
username_ed[MAX_PLAYER_NAME], dest[64], timestamp[32], BigVar[256];
cache_get_data(rows, fields);
if(rows > 0)
{
cache_get_row(row, 0, dest, ConnectionHandle); // fix the connection handle
reportid = strval(dest);
cache_get_row(row, 1, username_er, ConnectionHandle);
cache_get_row(row, 2, username_ed, ConnectionHandle);
cache_get_row(row, 4, dest, ConnectionHandle);
cache_get_row(row, 5, timestamp, ConnectionHandle); // is timestamp a string or what?
format(BigVar, sizeof(BigVar), "[%d] - Information On %s\n\nReported By %s\nTime: %s\nReason: %s", reportid, username_ed, username_er, timestamp, dest);
++row;
}
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LISTITEM, "Report Log Info", BigVar, "Back", "Close"); // make a feature to go back through ondialogresponse!
return 1;
}