28.06.2014, 04:26
I fixed it like this
Thanks tho
pawn Код:
CMD:reports(playerid,params[])
{
if(PlayerInfo[playerid][Admin] >= 1)
{
new Query[100];
format(Query,sizeof(Query),"SELECT * FROM `reports` ORDER BY `ID` DESC LIMIT 5");
mysql_function_query(cHandle, Query, true, "DisplayReports", "d", playerid);
}
else return NotAllowed(playerid);
return 1;
}
pawn Код:
public DisplayReports(playerid)
{
new rows, fields;
cache_get_data(rows, fields, cHandle);
if(rows)
{
new string[1000], reason[50], reporter[MAX_PLAYER_NAME], reportedplayer[MAX_PLAYER_NAME];
for(new i = 0; i < rows; i++)
{
//new mHolder[128];
cache_get_field_content(i, "Reporter", reporter, cHandle);
cache_get_field_content(i, "Name", reportedplayer, cHandle);
cache_get_field_content(i, "Reason", reason, cHandle);
format(string,sizeof(string),"%s\n"RED"Reporter: "WHITE"%s "RED"Suspect: "WHITE"%s "RED"Reason: "WHITE"%s",string,reportedplayer,reporter,reason);
ShowPlayerDialog(playerid, DIALOG_REPORTS, DIALOG_STYLE_MSGBOX, "Today's Last 5 reports",string,"Okay","");
}
}
else return SendClientMessage(playerid, -1, ""RED"[REPORTS] "WHITE"There are no reports to be shown.");
return 1;
}