SA-MP Forums Archive
Need help with saving system - 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: Need help with saving system (/showthread.php?tid=345537)



Need help with saving system (IMPORTANT) - wmt - 25.05.2012

I am sorry to disturb you, but I need to ask you a question. I'd like to describe my problem at first. I have I saving system that saves money, score (etc...) in a .ini file. For the player with name A the file is A.ini and for the player with name B the file is B.ini. I want my system to load the data from .ini files. I've made some code, but it doesn't work. Here it is:

Код:
	new Float:money;
	GetPlayerName(playerid,PlayerName,32);
	format(string,64,”%s.ini”,PlayerName);
	new inifile = ini_openFile(/save/playername.ini); 
	ini_getInteger(iniFile, "Money", money); 
	ini_closeFile(iniFile); 
	GivePlayerMoney(playerid,money);
What's wrong with it?! Could you explain me?

P.S.: Here's the full source code of my gamemode (link).

P.P.S.: The data is saved in /scriptfiles/save


Re: Need help with saving system - ViniBorn - 25.05.2012

pawn Код:
GetPlayerName(playerid,PlayerName,32);
format(string,64,”%s.ini”,PlayerName);
new inifile = ini_openFile(/save/playername.ini);
pawn Код:
GetPlayerName(playerid,PlayerName,MAX_PLAYER_NAME);
format(string,64,"/save/%s.ini",PlayerName);
new inifile = ini_openFile(string);



Re: Need help with saving system - Saad_ - 25.05.2012

What file system are you using (Dini, SII, Y_INI.....)


Re: Need help with saving system - wmt - 25.05.2012

Viniborn, I am just a newbie, so could give me the right code that will work?

P.S.: The .ini files are in /scriptfiles/save.


Re: Need help with saving system - HighPitchedVoice - 25.05.2012

He meant, the first one is the current and the second one is the working one.


Re: Need help with saving system - wmt - 25.05.2012

HighPitchedVoice, but the second one doesn't work.


Re: Need help with saving system - wmt - 25.05.2012

Saad_, I am not sure, but it may be mxINI.