10.07.2016, 00:09
I'm having a problem with a looping, it shows only the last ID of table, someone can help me?
Код:
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), "{FFFFFF}[%s] %s pegou uma %s \n", data, nome, arma);
}
Dialog_Show(extraid, ShowOnly, DIALOG_STYLE_LIST, "Registros de Armas", string, "Fechar", "");
return 1;
}

