SA-MP Forums Archive
Looping through 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Looping through files (/showthread.php?tid=162528)



Looping through files - MisterTickle - 23.07.2010

Basically, I need to make it update a variable every month (The timer to check that is in my server already) and go through all the file names. I use DJson (Dini2) for my saving. I can easily do this with my Businesses because they save at Biz - %d so I can just do a loop but, With files I cant because they same as Player Name.djson, I need to find a way to do exactly what I would do with the Business for the Player Files without using numbers.

I know that may have come across a bit confusing but, Please try to help if you can. Thanks.


Re: Looping through files - Gamer_Z - 23.07.2010

you must use a plugin or..
make a very recource hungry script but it will take forever to loop all files..


Re: Looping through files - MisterTickle - 23.07.2010

It only happens once a month so it isn't a big deal that the server might hang temporarily and I don't know if any plugins like that or scripts thats why I'm asking. I know SQL would be a better alternative but, Its only for one thing.


Re: Looping through files - bigcomfycouch - 23.07.2010

download the ysf plugin and use ffind
pawn Код:
new filename[32], j;
while(ffind("*.ini", filename, 64, j))
{
    //do stuff
}



Re: Looping through files - MisterTickle - 23.07.2010

Thank you very much!

I will try this and report back.


Re: Looping through files - MisterTickle - 27.07.2010

It didn't actually work but, I had problems getting it to run with the new version of SAMP as it is, Any suggestions?


Re: Looping through files - Conroy - 27.07.2010

I don't know if there is a function, or you need the players name to use his/her file.

Best way to go about it is: When the player registers, save his/her name, along with the other registered users names in a .txt. When you want to check all the files, search each line, take the user name and use it to get the file.

-Conroy


Re: Looping through files - MisterTickle - 27.07.2010

Couldn't there be a way to just get the ffind part of the YSF plugin to work in Pawn somehow so that it could just be put into my Gamemode?