[DINI] Help, why doesnt this work? - 
Niixie -  13.01.2010
Hey SAMP forum..
I've made a register system, and
OnPlayerDisconnect i have SaveStats(playerid);
like this
Код:
OnPlayerDisconnect(playerid)
{
   SaveStats(playerid);
   return 1;
}
 and my SaveStats func. is
Код:
stock SaveStats(playerid)
{
	if(IsLogged[playerid] == 1)
	{
		new file[24+15];
		new PName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, PName, sizeof(PName));
		format(file,sizeof(file),"N-Register/users/%s.ini",PName);
		dini_IntSet(file,"Cash", GetPlayerMoney(playerid));
		dini_IntSet(file,"Score", GetPlayerScore(playerid));
	}
}
 Why doesnt it work?
Re: [DINI] Help, why doesnt this work? - 
KnooL -  13.01.2010
Did you make the folders:
N-Register and Users?
Re: [DINI] Help, why doesnt this work? - 
Niixie -  13.01.2010
Yes, the file saves etc. but when i exit the game it doesnt save my score and money
Re: [DINI] Help, why doesnt this work? - 
Calgon -  13.01.2010
Are you sure IsLogged[playerid] = = 1?
Re: [DINI] Help, why doesnt this work? - 
KnooL -  13.01.2010
That variable is 1 for sure because the file saves, except it won't write any data. By the way, this looks almost the similair to my function that saves a players' file, I recommend dudb for you.
Re: [DINI] Help, why doesnt this work? - 
Calgon -  13.01.2010
Quote:
| 
					Originally Posted by KnooL 
 That variable is 1 for sure because the file saves, except it won't write any data. By the way, this looks almost the similair to my function that saves a players' file, I recommend dudb for you. | 
 My bad, so I assume every other variable saves?
Re: [DINI] Help, why doesnt this work? - 
Grim_ -  13.01.2010
There are a couple errors. I don't know whether or not they will solve your problem, but:
pawn Код:
OnPlayerDisconnect(playerid, reason)
 This callback also has the parameter "reason".
Don't make the script do extra. 
Also, SaveStats should return 1.
--------
Also, try making the variable "file" have a larger string. E.G. 
Re: [DINI] Help, why doesnt this work? - 
Calgon -  13.01.2010
Quote:
| 
					Originally Posted by _Xerxes_ 
 There are a couple errors. I don't know whether or not they will solve your problem, but: 
pawn Код: OnPlayerDisconnect(playerid, reason)
 This callback also has the parameter "reason".
 Don't make the script do extra. 
 
Also, SaveStats should return 1.
 
-------- 
Also, try making the variable "file" have a larger string. E.G.  | 
 1) It doesn't matter if you return any value, using a stock.
2) There's no point in creating extra cells that WON'T get used.
Re: [DINI] Help, why doesnt this work? - 
Grim_ -  13.01.2010
1.You should return a value to a function whether it is a stock or not.
2. Currently "39" is to small to read that whole format. (The root+name of player). So it will be used.
Re: [DINI] Help, why doesnt this work? - 
Calgon -  13.01.2010
Quote:
| 
					Originally Posted by _Xerxes_ 
 1.You should return a value to a function whether it is a stock or not.2. Currently "39" is to small to read that whole format. (The root+name of player). So it will be used.
 | 
 1) No, you shouldn't, nor do you have to.
2) Yes, it is, but 128 cells aren't needed for something that is 45 characters long MAX_PLAYER_NAME is 24 characters and "N-Register/users/.ini" (not including the player name) is 21 characters, so 21+24=45.