loop though folder names and load each one
#1

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.
Reply
#2

Nvm got it wrong..
Reply
#3

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?
Reply
#4

but i need this now
i know there's away
Reply
#5

Impossible, well, at least not possible without a plugin which supports file/directory listing.
Like this one.
Reply
#6

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;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)