Y_INI Repeating
#1

Everytime I Quit Server I get Files OverWritten Over again after I Already had them
It keeps Repeating

My Code
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    PlayerInfo[playerid][pPos_x] = x;
    PlayerInfo[playerid][pPos_y] = y;
    PlayerInfo[playerid][pPos_z] = z;
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerCash(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Model",PlayerInfo[playerid][pModel]);
    INI_WriteInt(File,"Job",PlayerInfo[playerid][pJob]);
    INI_WriteInt(File,"Arms Dealer Skill",PlayerInfo[playerid][pArmsSkill]);
    INI_WriteInt(File,"Warnings",PlayerInfo[playerid][pWarns]);
    INI_WriteInt(File,"Virtual World",PlayerInfo[playerid][pVW]);
    INI_WriteInt(File,"Interior",PlayerInfo[playerid][pInterior]);
    INI_WriteInt(File,"Faction",PlayerInfo[playerid][pTeam]);
    INI_WriteInt(File,"Leader",PlayerInfo[playerid][pLeader]);
    INI_WriteInt(File,"Member",PlayerInfo[playerid][pMember]);
    INI_WriteInt(File,"Gender",PlayerInfo[playerid][pGender]);
    INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
    INI_WriteInt(File,"BizID",PlayerInfo[playerid][BizID]);
    INI_WriteInt(File,"Pilot License",PlayerInfo[playerid][pPLic]);
    INI_WriteInt(File,"Drivers License",PlayerInfo[playerid][pDLic]);
    INI_WriteInt(File,"Weapon License",PlayerInfo[playerid][pWLic]);
    INI_WriteFloat(File,"Pos_x",PlayerInfo[playerid][pPos_x]);
    INI_WriteFloat(File,"Pos_y",PlayerInfo[playerid][pPos_y]);
    INI_WriteFloat(File,"Pos_z",PlayerInfo[playerid][pPos_z]);
    INI_Close(File);
    return 1;
}
This is What THE INI User File looks like
Код:
Arms Dealer Skill = 0
Virtual World = 0
Pilot License = 0
Drivers License = 0
Weapon License = 0
Arms Dealer Skill = 0
Virtual World = 0
Pilot License = 0
Drivers License = 0
Weapon License = 0
Arms Dealer Skill = 0
Virtual World = 0
Pilot License = 0
Drivers License = 0
Weapon License = 0
Reply
#2

Try this:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    PlayerInfo[playerid][pPos_x] = x;
    PlayerInfo[playerid][pPos_y] = y;
    PlayerInfo[playerid][pPos_z] = z;
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerCash(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Model",PlayerInfo[playerid][pModel]);
    INI_WriteInt(File,"Job",PlayerInfo[playerid][pJob]);
    INI_WriteInt(File,"Arms_Dealer_Skill",PlayerInfo[playerid][pArmsSkill]);
    INI_WriteInt(File,"Warnings",PlayerInfo[playerid][pWarns]);
    INI_WriteInt(File,"Virtual_World",PlayerInfo[playerid][pVW]);
    INI_WriteInt(File,"Interior",PlayerInfo[playerid][pInterior]);
    INI_WriteInt(File,"Faction",PlayerInfo[playerid][pTeam]);
    INI_WriteInt(File,"Leader",PlayerInfo[playerid][pLeader]);
    INI_WriteInt(File,"Member",PlayerInfo[playerid][pMember]);
    INI_WriteInt(File,"Gender",PlayerInfo[playerid][pGender]);
    INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
    INI_WriteInt(File,"BizID",PlayerInfo[playerid][BizID]);
    INI_WriteInt(File,"Pilot_License",PlayerInfo[playerid][pPLic]);
    INI_WriteInt(File,"Drivers_License",PlayerInfo[playerid][pDLic]);
    INI_WriteInt(File,"Weapon_License",PlayerInfo[playerid][pWLic]);
    INI_WriteFloat(File,"Pos_x",PlayerInfo[playerid][pPos_x]);
    INI_WriteFloat(File,"Pos_y",PlayerInfo[playerid][pPos_y]);
    INI_WriteFloat(File,"Pos_z",PlayerInfo[playerid][pPos_z]);
    INI_Close(File);
That over and over writng is cuz you added spaces in the name ... next time add _ instead of space (I had the same problem with saving weapons. I just replaced the spaces with _ and everything works now)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)