21.02.2018, 19:21
I am converting my report system to SQLite.
My question is, how do i detect which report the admin has selected?
can it be done with inputtext? what output will inputtext have?
code:
My question is, how do i detect which report the admin has selected?
can it be done with inputtext? what output will inputtext have?
code:
PHP код:
CMD:pendingreports(playerid,params[])
{
new str[1024], string2[1024], string[1024], szQuery[128], status[25];
new DBResult:REPORTS_RESULT;
format(szQuery, sizeof(szQuery), "select * from `REPORTS`");
REPORTS_RESULT = db_query(LARP_DATABASE, szQuery);
if(AdminLevel[playerid] >=2)
{
for(new i = 1; i < MAX_REPORTS; i++)
{
new DBResult:REPORTS_RESULT_FINAL;
new reportstatus[5], szQuery2[128];
format(szQuery2, sizeof(szQuery2), "select * from `REPORTS` where `ID` = '%d'", i);
REPORTS_RESULT_FINAL = db_query(LARP_DATABASE, szQuery2);
db_get_field_assoc(REPORTS_RESULT_FINAL, "ID", ReportInfo[i][ReportID], 5);
db_get_field_assoc(REPORTS_RESULT_FINAL, "Status", reportstatus, sizeof(reportstatus));
db_get_field_assoc(REPORTS_RESULT_FINAL, "PlayerName", ReportInfo[i][ReportedName], 124);
db_get_field_assoc(REPORTS_RESULT_FINAL, "Reported", ReportInfo[i][ReportedBy], 124);
db_get_field_assoc(REPORTS_RESULT_FINAL, "Report", ReportInfo[i][ReportedReason], 124);
db_get_field_assoc(REPORTS_RESULT_FINAL, "Date", ReportInfo[i][ReportedDate], 124);
ReportInfo[i][ReportStatus] = strval(reportstatus);
printf(ReportInfo[i][ReportID]);
printf(ReportInfo[i][ReportStatus]);
if(ReportInfo[i][ReportStatus] == 0) {status="{FF8000}Pending";}
if(ReportInfo[i][ReportStatus] == 1) {status="{00CC00}Open";}
format(str,sizeof(str),"[%s] #%d\t%s\t%s\t%s\n",ReportInfo[i][ReportedDate], strval(ReportInfo[i][ReportID]), ReportInfo[i][ReportedName], ReportInfo[i][ReportedReason],status);
strcat(string2,str);
}
format(str,sizeof(str),"Report ID\tReported Name\tReason\tStatus\n%s", string2);
strcat(string,str);
ShowPlayerDialog(playerid, DIALOG_PENDINGREPORTS+1, DIALOG_STYLE_TABLIST_HEADERS, "Pending Reports", string, "Select", "Back");
db_free_result(REPORTS_RESULT);
}
return 1;
}