SA-MP Forums Archive
Is it possible to create a txt file in-game? - 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: Is it possible to create a txt file in-game? (/showthread.php?tid=538832)



Is it possible to create a txt file in-game? - Ox1gEN - 24.09.2014

I wonder if it possible to create a txt file in game, but I'm not talking about a regular file created by libraries.

I wonder if it possible to use those f-functions (fopen, fclose), I ******d this yet I couldn't find anything.
And if not, when using ini libraries it is possible to insert a formatted string into a file right?

(Haven't used ini libraries in a while..)


Re: Is it possible to create a txt file in-game? - SWGamer - 24.09.2014

Hello.Maybe this would help.
https://sampwiki.blast.hk/wiki/File_Functions


Re: Is it possible to create a txt file in-game? - Sawalha - 24.09.2014

yes, as he said above, but, i advice you using ******'s one, (y_ini) Fast saving and loading.


Re: Is it possible to create a txt file in-game? - Ox1gEN - 24.09.2014

As I've stated.
I'd like not to use any sort of library, I want to use functions instead but if that isn't possible.
Then y_ini would be the one I'd go with.


Re: Is it possible to create a txt file in-game? - Pottus - 24.09.2014

Depends on what your doing, if it's a user file system then you will want y_ini at the very least if you are just exporting/importing data then the file functions alone are suitable.


Re: Is it possible to create a txt file in-game? - Ox1gEN - 24.09.2014

No, no, I'm actually attempting to create a dynamic system that'll create information into an ini file.
Also I'd like it to create a file using a function in pawno, I wonder if fopen wouldn't just open a ini file or a txt one but create one aswell if it exists?
Anyways it's not for loading or saving, it's just for simple writing.


Re: Is it possible to create a txt file in-game? - Stinged - 24.09.2014

If you want it to be like this:
Код:
Key = Value
Then you should just use y_ini.

But if you want to write something else, use the sa-mp file functions.


Re: Is it possible to create a txt file in-game? - Ox1gEN - 24.09.2014

I know that, but if you could read my post above and reply.

And I'd like to mention again, does fopen creates/opens a file or just opens it?


Re: Is it possible to create a txt file in-game? - Stinged - 24.09.2014

Quote:
Originally Posted by Ox1gEN
Посмотреть сообщение
I know that, but if you could read my post above and reply.

And I'd like to mention again, does fopen creates/opens a file or just opens it?
If it's io_write, then it creates and opens it.
If it was io_append, io_read, it opens it (Note server will crash if it doesn't exist)

I'm not really sure about this but I think io_readwrite also opens it and also crashes if doesn't exists.


Re: Is it possible to create a txt file in-game? - Ox1gEN - 24.09.2014

Quote:
Originally Posted by Stinged
Посмотреть сообщение
If it's io_write, then it creates and opens it.
If it was io_append, io_read, it opens it (Note server will crash if it doesn't exist)

I'm not really sure about this but I think io_readwrite also opens it and also crashes if doesn't exists.
You just gave me what I was looking for, thanks m8y m8.