SA-MP Forums Archive
Loop through all user 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 through all user files (/showthread.php?tid=388483)



Loop through all user files - justinnater - 28.10.2012

Hey, i want to make a command to check whos in your faction, including the offline members, so can someone explain me how to make a loop through all user files? Im using Dini... Unfortunately.

Thanks in advance.


Re: Loop through all user files - ryansheilds - 28.10.2012

You can't. The only way you could loop though them is if they were numbered (1.ini 2.ini...).


Re: Loop through all user files - ReneG - 28.10.2012

Use y_files, or name files with an auto increment integer. There is no native way to loop through files unless you know the names of them before hand.


Re: Loop through all user files - Eric - 28.10.2012

If you were using MySQL you'd be able to but as the others have said, with a file based script, there isn't a practical way.


Re: Loop through all user files - Emmet_ - 28.10.2012

Or you can create an .ini file and store faction member's names inside, then you can use fread to fetch the data.

https://sampwiki.blast.hk/wiki/fread
https://sampwiki.blast.hk/wiki/fopen
https://sampwiki.blast.hk/wiki/fwrite