11/10/2021 20:24
Pessoal, fiquei um codigo e to tentando adaptalo, mas quando eu uso o comando para ver as denuncias, o campo ID aparece 0 em todas as vezes, e não consigo aceitar nem negar.
Código:
CMD:denuncias(playerid, params[])
{
new query[300];
if (DATA_INFO[playerid][pAdmin] < 1)
return SendErrorMessage(playerid, "Você não tem permissão para usar esse comando.");
mysql_format(mysql_c, query, sizeof(query), "SELECT * FROM `denuncias` ORDER BY `Date` LIMIT 15;");
new Cache:result = mysql_query(mysql_c, query);
if(cache_num_rows())
{
new string[2300], rinfo[1000], Reporter[24], Reported[24], Reason[200], Date[30], reportid, Accepted;
strcat(string, "Displaying 15 latest reports:\n\n");
for(new i = 0; i < cache_num_rows(); i++)
{
cache_get_field_content(i, "Reporter", Reporter, 24);
cache_get_field_content(i, "Reported", Reported, 24);
cache_get_field_content(i, "Reason", Reason, 200);
cache_get_field_content(i, "Date", Date, 30);
cache_get_field_content_int(i, "ID", reportid);
cache_get_field_content_int(i, "Accepted", Accepted);
switch(Accepted)
{
case 0: format(rinfo, sizeof(rinfo), "{AFAFAF}[ID: %d]: {FFFFFF}%s has reported %s for the reason {AFAFAF}'%s'{FFFFFF} on %s - {AFAFAF}Not Checked\n", reportid, Reporter, Reported, Reason, Date);
case 1: format(rinfo, sizeof(rinfo), "{AFAFAF}[ID: %d]: {FFFFFF}%s has reported %s for the reason {AFAFAF}'%s'{FFFFFF} on %s - {00AA00}Accepted\n", reportid, Reporter, Reported, Reason, Date);
case 2: format(rinfo, sizeof(rinfo), "{AFAFAF}[ID: %d]: {FFFFFF}%s has reported %s for the reason {AFAFAF}'%s'{FFFFFF} on %s - {FF0000}Denied\n", reportid, Reporter, Reported, Reason, Date);
}
strcat(string, rinfo);
}
Dialog_Show(playerid, DIALOG_REPORTS, DIALOG_STYLE_MSGBOX, "Latest 15 Reports", string, "Okay", "");
}
else
{
Dialog_Show(playerid, DIALOG_REPORTS, DIALOG_STYLE_MSGBOX, "No reports were found", "No reports were found on the MySQL mysql_c.", "Close", "");
}
cache_delete(result);
return 1;
}