SA-MP Forums Archive
How do I make it in a 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: How do I make it in a new line? (/showthread.php?tid=619001)



How do I make it in a new line? - Gotham - 12.10.2016

Hi guys,
I made a stock of logging commands but It makes it look like
Код:
Player blah performed the command /testPlayer blah performed the command /test
How do I fix this?
the LogCmd stock
PHP код:
stock LogCmd(event[])
{
   new 
File:log fopen(CMD_LOG,io_append);
   
fwrite(log,"\n");
   
fwrite(log,event);
   
fclose(log);

Thanks


Re: How do I make it in a new line? - Stinged - 12.10.2016

It should be like this:
Код:
new File :log = fopen(CMD_LOG, io_append);
fwrite(log, event);
fwrite(log, "\r\n");
fclose(log);



Re: How do I make it in a new line? - Konstantinos - 12.10.2016

Write something to the file and then go to the next line. Checking for invalid file handle is also important to avoid server crashes.

pawn Код:
LogCmd(event[])
{
    new File:log = fopen(CMD_LOG,io_append);

    if (log) return 0;

    fwrite(log,event);
    fwrite(log,"\r\n");
    fclose(log);
    return 1;
}



Re: How do I make it in a new line? - Gotham - 12.10.2016

Thanks!


Re: How do I make it in a new line? - Gotham - 12.10.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Write something to the file and then go to the next line. Checking for invalid file handle is also important to avoid server crashes.

pawn Код:
LogCmd(event[])
{
    new File:log = fopen(CMD_LOG,io_append);

    if (log) return 0;

    fwrite(log,event);
    fwrite(log,"\r\n");
    fclose(log);
    return 1;
}
This actually gives me a warning :c
EDIT:Oh you fixed it !