Detect listitem
#1

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:
PHP код:
CMD:pendingreports(playerid,params[])
{
    new 
str[1024], string2[1024], string[1024], szQuery[128], status[25];
    new 
DBResult:REPORTS_RESULT;
    
format(szQuerysizeof(szQuery), "select * from `REPORTS`");
    
REPORTS_RESULT db_query(LARP_DATABASEszQuery);
    if(
AdminLevel[playerid] >=2)
    {
        for(new 
1MAX_REPORTSi++)
        {
            new 
DBResult:REPORTS_RESULT_FINAL;
            new 
reportstatus[5], szQuery2[128];
            
format(szQuery2sizeof(szQuery2), "select * from `REPORTS` where `ID` = '%d'"i);
                
REPORTS_RESULT_FINAL db_query(LARP_DATABASEszQuery2);
            
db_get_field_assoc(REPORTS_RESULT_FINAL"ID"ReportInfo[i][ReportID], 5);
            
db_get_field_assoc(REPORTS_RESULT_FINAL"Status"reportstatussizeof(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(playeridDIALOG_PENDINGREPORTS+1DIALOG_STYLE_TABLIST_HEADERS"Pending Reports"string"Select""Back");
        
db_free_result(REPORTS_RESULT);
    }
    return 
1;

Reply


Messages In This Thread
Detect listitem - by jasperschellekens - 21.02.2018, 19:21
Re: Detect listitem - by NaS - 21.02.2018, 19:24
Re: Detect listitem - by Kaperstone - 21.02.2018, 19:32
Re: Detect listitem - by jasperschellekens - 01.05.2018, 18:12

Forum Jump:


Users browsing this thread: 1 Guest(s)