21.01.2014, 11:55
I am having problems with Y_INI, the userfile doesn't overwrite existing things but writes the file again.
How a normal user file looks like:
How mine looks like:
It seems to be occuring at OnPlayerDisconnect.
What can be the problem?
How a normal user file looks like:
pawn Код:
[Player Stats]
Score = 0
Deaths = 0
Admin = 5
Gmute = 0
Vip = 0
Health = 100
pawn Код:
[Player Stats]
Score = 5
Deaths = 0
Admin = 5
Gmute = 1
Vip = 0
Health = 100
[Player Stats]
Score = 0
Deaths = 0
Admin = 5
Gmute = 0
Vip = 0
Health = 100
[Player Stats]
Score = 0
Deaths = 0
Admin = 5
Gmute = 0
Vip = 0
Health = 100
[Player Stats]
Score = 1
Deaths =2
Admin = 5
Gmute = 0
Vip = 0
Health = 100
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file, "[Player Stats]");
INI_WriteInt(file,"Score",GetPlayerScore(playerid));
INI_WriteInt(file,"Deaths",pStats[playerid][deaths]);
INI_WriteInt(file,"Admin",pStats[playerid][admin]);
INI_WriteInt(file,"Health",pStats[playerid][health]);
INI_WriteInt(file,"Vip",pStats[playerid][vip]);
INI_WriteInt(file,"Gmute",pStats[playerid][gmute]);
INI_Close(file);
SaveInventory(playerid);
new pname[MAX_PLAYER_NAME], string[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
switch(reason)
{
case 0: format(string, sizeof(string), TEXT_LEFTCRASHED, pname);
case 1: format(string, sizeof(string), TEXT_LEFTMANUAL, pname);
case 2: format(string, sizeof(string), TEXT_LEFTKICKED, pname);
}
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}