Raised This Month: $51 Target: $400
 12% 

[REQ] From fopen to...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tatu Eugen
Member
Join Date: Apr 2010
Old 08-29-2016 , 08:40   [REQ] From fopen to...
Reply With Quote #1

Can someone to transfer this functions to nvault,fvault, sql? Thanks

Code:
public Load(id)
{
	if(!is_user_connected(id))
		return PLUGIN_HANDLED;
 
	new pFile, Name[32];
	pFile = fopen(SaveFile, "rt");
	get_user_name(id, Name, 31);
 
	if(pFile)
	{
		new Line[1024];
		new LineName[32];
		new data[16];
 
		while(!feof(pFile))
		{
			fgets(pFile, Line, 1023);
 
			if(Line[0] == ';' || !strlen(Line))
				continue;
 
			strbreak(Line, LineName, 31, Line, 1023);
 
			if(equal(LineName, Name))
			{
				strbreak(Line, data, 15, Line, 1023); Kills[id] = str_to_num(data);
				strbreak(Line, data, 15, Line, 1023); Points[id] = str_to_num(data);
				strbreak(Line, data, 15, Line, 1023); pKey[id] = str_to_num(data);
				strbreak(Line, data, 15, Line, 1023); Chest[id] = str_to_num(data);
				strbreak(Line, data, 15, Line, 1023); Rang[id] = str_to_num(data);
				for(new i; i < MAX; i++)
				{
					strbreak(Line, data, 15, Line, 1023);
					uWeapon[i][id] = str_to_num(data);
				}
				fclose(pFile);
				return PLUGIN_HANDLED;
			}
		}
		fclose(pFile);
	}
	return PLUGIN_CONTINUE;
}
public Save(id)
{
	if(!is_user_connected(id))
		return PLUGIN_HANDLED;
 
	new pFile, Name[32];
	pFile = fopen(SaveFile, "rt");
	get_user_name(id, Name, 31);
 
	if(pFile)
	{
		new Line[192], Lines;
		new LineName[32], bool:Found;
		new mLine[1024], LoadWeapon[1024], String[16];
 
		format(String, 15, "^"%i^" ", Kills[id]);
		add(LoadWeapon, 1023, String);
 
		format(String, 15, "^"%i^" ", Points[id]);
		add(LoadWeapon, 1023, String);
 
		format(String, 15, "^"%i^" ", pKey[id]);
		add(LoadWeapon, 1023, String);
 
		format(String, 15, "^"%i^" ", Chest[id]);
		add(LoadWeapon, 1023, String);
 
		format(String, 15, "^"%i^" ", Rang[id]);
		add(LoadWeapon, 1023, String);
 
		for(new i; i < MAX; i++)
		{
			format(String, 15, "^"%i^" ", uWeapon[i][id]);
			add(LoadWeapon, 1023, String);
		}
 
		formatex(mLine, 1023, "^"%s^" %s", Name, LoadWeapon);
		while(!feof(pFile))
		{
			fgets(pFile, Line, 191);
 
			if(Line[0] == ';' || strlen(Line) < 2)
				continue;
 
			parse(Line, LineName, 31);
 
			if(equal(LineName, Name) && !Found)
			{
				write_file(SaveFile, mLine, Lines);
				fclose(pFile);
				Found = true;
				return PLUGIN_HANDLED;
			}
 
			Lines++;
		}
 
		if(!Found)
		{
			write_file(SaveFile, mLine);
			fclose(pFile);
			return PLUGIN_HANDLED;
		}
		fclose(pFile);
	}
	return PLUGIN_CONTINUE;
}
__________________
Tatu Eugen is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-29-2016 , 20:14   Re: [REQ] From fopen to...
Reply With Quote #2

Well, which one do you want? Also, you should attach the .sma file so someone would be able to test it.
__________________
fysiks is offline
Tatu Eugen
Member
Join Date: Apr 2010
Old 09-01-2016 , 02:00   Re: [REQ] From fopen to...
Reply With Quote #3

I want to mysql if posible... if not vault is oke
__________________

Last edited by Tatu Eugen; 09-19-2016 at 16:41.
Tatu Eugen is offline
Tatu Eugen
Member
Join Date: Apr 2010
Old 09-04-2016 , 14:12   Re: [REQ] From fopen to...
Reply With Quote #4

Someone can help?
__________________
Tatu Eugen is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode