loop though folder names and load each one - 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 though folder names and load each one (
/showthread.php?tid=370986)
FFind help -
cssbart - 21.08.2012
im trying to convert my user system to mysql and i know how but i not sure on how to convert all users at the same time. Is there away to get the name of each file in the folder users and then pass it on to a loadplayer function and then load that user so i can then save that user in the mysql and then repeat it with another user file. i know how to save it all after its loaded but i need to know how to get the files names of all the files in the folder users.
Re: loop though folder names and load each one -
CoDeZ - 21.08.2012
Nvm got it wrong..
Re: loop though folder names and load each one -
NinjaChicken - 22.08.2012
so you mean change the saving to mysql so when a player connects it loads his account and say buys a car is then saves into the mysql database? and say leave it like that for a couple of months to get everyones account into the database then just change the loading to mysql too?
Re: loop though folder names and load each one -
cssbart - 22.08.2012
but i need this now

i know there's away
Re: loop though folder names and load each one -
Virtual1ty - 22.08.2012
Impossible, well, at least not possible without a plugin which supports file/directory listing.
Like
this one.
Re: loop though folder names and load each one -
cssbart - 22.08.2012
i used the plugin works but when i feed it to a mysql query it only does one
its does the mysql bit but only one file
Код:
if(strcmp(cmd, "/users", true) == 0 && IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_GRAD3,"posting");
new dir:dHandle = dir_open("/Users/Jonny/SA-MP/0.3e/scriptfiles/users/");
new item[40], type;
while(dir_list(dHandle, item, type))
{
if(type == FM_FILE)
{
printf("%s is a file", item);
new szDestination[100];
mysql_format(mysql, szDestination, "INSERT INTO users (pName) VALUES ('%s')", item);
mysql_function_query(mysql,szDestination);
}
}
dir_close(dHandle);
return 1;
}