load report - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: load report (
/showthread.php?tid=596848)
load report -
GeneralAref - 23.12.2015
i have this code.how to make load and delete for this:
PHP код:
Reports = fopen("Asystem/Reports.ini", io_append);
format(string,sizeof(string),"%s(%d) has reported %s(%d).Reason: %s", sender, playerid, receiver, id, reason);
fwrite(Reports, string);
fclose(Reports);
Re: load report -
IceBilizard - 23.12.2015
Put this somewhere in your script
PHP код:
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 код:
CMD:reports(playerid, params[])
{
if (!IsPlayerAdmin(playerid)) return 0;
new strings[128], File: file = fopen("Asystem/Reports.ini", io_read), idxx=1;
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 код:
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);
return 1;
}
Re: load report -
GeneralAref - 23.12.2015
very very very thanks.