SA-MP Forums Archive
File save problem - 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: File save problem (/showthread.php?tid=328194)



File save problem - Tanush123 - 24.03.2012

Well i made a anti advertise and it also logs in a .txt. The problem is if another person ad's, it will create the text on the same line, i want that it will create a new line on the .txt
pawn Код:
new File:pos=fopen("Advertisers.txt", io_append);
            format(str,sizeof(str),"%s: %s (%s %d, %d : %d)",Nam,text,Months[bmonth - 1],bday,bhour,bminute);
            fwrite(pos, str);
            fclose(pos);



Re: File save problem - ddnbb - 24.03.2012

Quote:
Originally Posted by Tanush123
Посмотреть сообщение
Well i made a anti advertise and it also logs in a .txt. The problem is if another person ad's, it will create the text on the same line, i want that it will create a new line on the .txt
pawn Код:
new File:pos=fopen("Advertisers.txt", io_append);
            format(str,sizeof(str),"%s: %s (%s %d, %d : %d)",Nam,text,Months[bmonth - 1],bday,bhour,bminute);
            fwrite(pos, str);
            fclose(pos);
pawn Код:
new File:pos=fopen("Advertisers.txt", io_append);
            format(str,sizeof(str),"%s: %s (%s %d, %d : %d)\n",Nam,text,Months[bmonth - 1],bday,bhour,bminute);
            fwrite(pos, str);
            fclose(pos);
Try that and tell me if it works.


Re: File save problem - Reklez - 24.03.2012

ddnbb code will not work too.

try doing this

pawn Код:
format(str,sizeof(str),"%s: %s (%s %d, %d : %d)\r\n",Nam,text,Months[bmonth - 1],bday,bhour,bminute);
hope it work


Re: File save problem - Tanush123 - 24.03.2012

i forgot about using \n lol. Thank you ddnbb, repped.