[Help]Dialog List
#1

Hello I would like it to list the persons crime when you type in the persons name. I am very lost at the moment so I am unsure on how to implement this into it. Thanks for the responses.



PHP код:
        case EFactionsDialog_Wanted: {
        {
        if (
response)
        {
        new 
rows, fields;
        new 
id_string[128];
        new 
string[128];
        new 
giveplayerid;
        
giveplayerid = ReturnUser(inputtext);
            
            new 
dstring[256];
            new 
sendername[MAX_PLAYER_NAME];
            new 
sqlid = strval(inputtext);
            
sendCrimes(playerid, sqlid);
            
format(dstring, sizeof(dstring), "Players Warrents(%s)\nNumber of Warrents(%d)",string,GetPlayerWantedLevel(giveplayerid));
            
ShowPlayerDialog(playerid,EFactionsDialog_Wanted,DIALOG_STYLE_MSGBOX,"MOBILE DATA COMPUTER",dstring,"Select","Cancel");
            }
        }
    } 
PHP код:
sendCrimes(playerid, sqlid) {
    
format(query, sizeof(query), "SELECT `crimes`.`id`,`c1`.`username`,`c2`.`username`,`reason`,`issuetime` FROM `crimes` INNER JOIN `characters` AS `c1` ON `c1`.`id` = `suspect` LEFT JOIN `characters` AS `c2` ON `c2`.`id` = `issuer` WHERE `suspect` = %d",sqlid);
    
mysql_function_query(g_mysql_handle, query, true, "OnCrimesRetrieve", "d",playerid);
} 
PHP код:
forward OnCrimesRetrieve(playerid);
public 
OnCrimesRetrieve(playerid) {
    new 
rows, fields;
    new 
id_string[128];
    new 
string[128];
    
cache_get_data(rows, fields);
    if(
rows > 0) {
        for(new 
i=0;i<rows;i++) {
            
cache_get_row(i, 2, id_string);
            if(!
strcmp(id_string, "NULL", true)) {
                
format(string, sizeof(string), "* Issuer: %s",id_string);
                
SendClientMessage(playerid, X11_WHITE,string);
            }
            
cache_get_row(i, 3, id_string);
            
format(string, sizeof(string), "* Reason: %s",id_string);
            
SendClientMessage(playerid, X11_WHITE,string);
            
cache_get_row(i, 4, id_string);
            if(
id_string[0] == '0') {
                
format(string, sizeof(string), "* Issued: %s",id_string);
                
SendClientMessage(playerid, X11_WHITE,string);
            }
        }
    }
} 
Reply
#2

bump
Reply


Forum Jump:


Users browsing this thread: