take this as example
Put this somewhere in your script
PHP Code:
fdeleteline(filename[], line)
{
new count, string[256], File:file, File:temp;
file= fopen(filename, io_read);
temp = fopen("tmpfile.tmp", io_write);
while (fread(file, string))
if (++count != line)
fwrite(temp, string);
fclose(file);
fclose(temp);
file= fopen(filename, io_write);
temp = fopen("tmpfile.tmp", io_read);
while (fread(temp, string))
fwrite(file, string);
fclose(file);
fclose(temp);
fremove("tmpfile.tmp");
}
Then for read reports
PHP Code:
CMD:reports(playerid, params[])
{
if (!IsPlayerAdmin(playerid)) return 0;
new strings[128], File: file = fopen("Asystem/Reports.ini", io_read), idxx=1;//You can change your folder destination
SendClientMessage(playerid, COLOR_ORANGE, "[Reports]:");
while(fread(file, strings))
{
format(strings, sizeof(strings), "%d) %s", idxx, strings);
SendClientMessage(playerid, COLOR_ORANGE, strings);
idxx ++;
}
fclose(file);
return 1;
}
Then Delete a report
PHP Code:
CMD:deletereport(playerid, params[])
{
new line;
new ppname[MAX_PLAYER_NAME];
if (!IsPlayerAdmin(playerid)) return 0;
if(sscanf(params, "d", line)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /deletereport [reportid]");
SendClientMessage(playerid, COLOR_YELLOW, "Report deleted.");
if(line < 1) return SendClientMessage(playerid, COLOR_RED, "Invalid report id.");
fdeleteline("Asystem/Reports.ini", line);//You can change your folder destination
return 1;
}