13.12.2017, 13:00
Hello there,
I am stuck at something.
I managed to save /report succesfully.
But how to make it load?
And more important, how to make it only show latest 10 reports?
code
Could someone provide me with a small example on how to load the latest 10 reports from that file?
I know about https://sampwiki.blast.hk/wiki/Fread
But i just don't get how to show them:
Thanks in advance
I am stuck at something.
I managed to save /report succesfully.
But how to make it load?
And more important, how to make it only show latest 10 reports?
code
Код:
new File:log = fopen("Logs/playerreports.txt", io_append);
if(log)
{
getdate(Year, Month, Day);
gettime(hours, minutes, seconds);
format(string,sizeof(string),"[%d/%d/%d][%d:%d:%d]%s reported %s (Reason: %s)'\n\n",Day,Month,Year,hours,minutes,seconds,PlayerName(ID),PlayerName(playerid),reason);
fwrite(log, string);
fclose(log);
}
else
{
print("Failed to open file \"playerreports.txt\".");
}
I know about https://sampwiki.blast.hk/wiki/Fread
But i just don't get how to show them:
Код:
if(handle)
{
// Success
// Read the whole file
while(fread(handle, buf)) print(buf);
// Close the file
fclose(handle);
}



