SA-MP Forums Archive
Log Saving not starting new line. - 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: Log Saving not starting new line. (/showthread.php?tid=505804)



Log Saving not starting new line. - VerticalGaming - 10.04.2014

Hello, I've made a MAPPER Log for each mapping command ingame, as someone removed everything. (admin probarly).
Now, I had a backup so it doesnt matter.
Now I want to make a log system to catch such a children in the future.

I've made a Map saving log system.
And it is working.
But, it isnt starting a new line like I asked, for each log.
For ban it is starting a new line.
But why not for Mapping log?

pawn Код:
public BanLog(string[])
{
    new entry[256];
    format(entry, sizeof(entry), "%s\n",string); // This one working perfectly. :)
    new File:hFile;
    hFile = fopen("ban.log", io_append);
    fwrite(hFile, entry);
    fclose(hFile);
}

public MapLog(string[])
{
    new entry[256];
    format(entry, sizeof(entry), "%s\n",string); // This one WONT start a NEW LINE
    new File:hFile;
    hFile = fopen("map.log", io_append);
    fwrite(hFile, entry);
    fclose(hFile);
}



Re: Log Saving not starting new line. - Bingo - 10.04.2014

Try making maplog manually using notepad?


Re: Log Saving not starting new line. - VerticalGaming - 10.04.2014

Quote:
Originally Posted by [vTc]Patroool
Посмотреть сообщение
Try making maplog manually using notepad?
...?
There are like 5000 objects being editted/saved/created/deleted each day.
Wont make a maplog myself.


Re: Log Saving not starting new line. - Bingo - 10.04.2014

Quote:
Originally Posted by VerticalGaming
Посмотреть сообщение
...?
There are like 5000 objects being editted/saved/created/deleted each day.
Wont make a maplog myself.
Sure, Nvm what you are doing, If you think you know then go ahead ^^

Good luck.


Re: Log Saving not starting new line. - VerticalGaming - 10.04.2014

Quote:
Originally Posted by [vTc]Patroool
Посмотреть сообщение
Call your service provider he will help you then.

Good luck.
The fuck, are you talking shit?
Service provider?

This is fucking scripted in PAWNO man. I'm using my localhost to test everything.
I was opening it with notepad.

But it wont create a new line. (the log system).
It's a bug in the script, not from the provider/notepad thingy.
Dammed bro.


Re: Log Saving not starting new line. - Mario' - 10.04.2014

pawn Код:
format(entry, sizeof(entry), "%s\r\n",string);
Use \r\n to start a new line, if that is the problem you have.


Re: Log Saving not starting new line. - Bingo - 10.04.2014

Quote:
Originally Posted by VerticalGaming
Посмотреть сообщение
The fuck, are you talking shit?
Service provider?

This is fucking scripted in PAWNO man. I'm using my localhost to test everything.
I was opening it with notepad.

But it wont create a new line. (the log system).
It's a bug in the script, not from the provider/notepad thingy.
Dammed bro.
I replied on wrong thread lol.
It was on downloading issue of a guy.

I editted if you have patience.

Edit: (Try) Open it with wordpad.


Re: Log Saving not starting new line. - Konstantinos - 10.04.2014

Check if the file handle is valid before writing to/closing the file to avoid server crashes.

pawn Код:
new File:hFile;
hFile = fopen("map.log", io_append);
if (hFile)
{
    fwrite(hFile, entry);
    fclose(hFile);
}
Do the same for the ban logs as well.