SA-MP Forums Archive
Loop .ini files - 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: Loop .ini files (/showthread.php?tid=657447)



Loop .ini files - 3417512908 - 07.08.2018

Hi guys.
My server was used Y_INI
But now I have too many user files just like Alex.ini 8642.ini [LAS]Gordon.ini ....... over 1000
And problem is incoming:How to read every .ini files?I want to change my save system to SQLite and convert all players files.


Re: Loop .ini files - NaS - 07.08.2018

https://sampforum.blast.hk/showthread.php?tid=653119

You only need to have this plugin for the purpose of getting a list of all files.

Use OpenDir on the User directory, and then use DirNext in a loop to get all file names.
From there you can read each file's data like usual and insert it into the database.

There's an example in the plugin release thread too.


Re: Loop .ini files - DBZdabIt3Bro7 - 07.08.2018

You shouldn't be using Pawn (specificly for SA-MP) to do something like that (reading ~1000 files then insert all the data to a SQLite database).


Re: Loop .ini files - NaS - 07.08.2018

Quote:
Originally Posted by DBZdabIt3Bro7
Посмотреть сообщение
You shouldn't be using Pawn (specificly for SA-MP) to do something like that (reading ~1000 files then insert all the data to a SQLite database).
Why? Even if it takes 10 minutes to execute (which it won't), what's the problem? It's solvable in a few minutes with a few lines of code.