Problem with Loop
#2

PHP код:
stock VerLogsArmas(playerid)
{
    new
        
string[128],
        
factionid = PlayerData[playerid][pFaction];
    
format(string, sizeof(string), "SELECT * FROM `zLogFaccaoID%d` ORDER BY 'ID' DESC", FactionData[factionid][factionID]);
    
mysql_tquery(g_iHandle, string, "OnViewLogsArmas", "d", playerid);
    return 
1;
}
forward OnViewLogsArmas(extraid, name[]);
public 
OnViewLogsArmas(extraid, name[])
{
    new
        
string[1024],
        
nome[24],
        
arma[32],
        
data[64],
        
rows,
        
fields;
    
cache_get_data(rows, fields, g_iHandle);
    if (!
rows)
        return 
SendErrorMessage(extraid, "Nenhum registro encontrado!");
    for (new 
i = 0; i < rows; i ++) {
         
cache_get_field_content(i, "Data", data, g_iHandle, sizeof(data));
        
cache_get_field_content(i, "Nome", nome, g_iHandle, sizeof(nome));
        
cache_get_field_content(i, "Arma", arma, g_iHandle, sizeof(arma));
        
format(string, sizeof(string), "%s{FFFFFF}[%s] %s pegou uma %s \n", string, data, nome, arma);
    }
    
Dialog_Show(extraid, ShowOnly, DIALOG_STYLE_LIST, "Registros de Armas", string, "Fechar", "");
    return 
1;
} 
You was resetting the string every row.
Reply


Messages In This Thread
Problem with Loop - by iWindows - 10.07.2016, 00:09
Re: Problem with Loop - by J0sh... - 10.07.2016, 00:11

Forum Jump:


Users browsing this thread: 1 Guest(s)