Y_INI problem, nty
#1

pawn Код:
stock SavePlayer(playerid)
{
    if(gLoggedIn[playerid] == 1)
    {
    new INI:File = INI_Open(UserSavePath(playerid));
    INI_SetTag(File,"Data");
    INI_WriteInt(File, "Level", PlayerInfo[playerid][pLevel]);
    INI_WriteInt(File, "Administration", PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File, "Mail-Box", PlayerInfo[playerid][pMailBox]);
    INI_WriteInt(File, "House Key", PlayerInfo[playerid][pHouseKey]);
    INI_WriteInt(File, "VIP Level", PlayerInfo[playerid][pVIP]);
    INI_WriteInt(File, "Skin ID", PlayerInfo[playerid][pSkinID]);
    INI_WriteInt(File, "Playing Hours", PlayerInfo[playerid][pConnectTime]);
    INI_WriteInt(File, "Kills", PlayerInfo[playerid][pKills]);
    INI_WriteInt(File, "Deaths", PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File, "Age", PlayerInfo[playerid][pAge]);
    INI_WriteInt(File, "Gender", PlayerInfo[playerid][pGender]);
    // Job Saving
    INI_WriteInt(File, "Job", PlayerInfo[playerid][pJob]);
    INI_WriteInt(File, "Job2", PlayerInfo[playerid][pJob2]);
    /// DOB
    INI_WriteInt(File, "DOBMonth", PlayerInfo[playerid][pDOBMonth]);
    INI_WriteInt(File, "DOBDate", PlayerInfo[playerid][pDOBDate]);
    INI_WriteInt(File, "DOBYear", PlayerInfo[playerid][pDOBYear]);
    // Banking Saving
    INI_WriteInt(File, "BankMoney1", BankInfo[playerid][pBankMoney][0]);
    INI_WriteInt(File, "BankActive1", BankInfo[playerid][pActiveAcc][0]);
    INI_WriteInt(File, "BankMoney2", BankInfo[playerid][pBankMoney][1]);
    INI_WriteInt(File, "BankActive2", BankInfo[playerid][pActiveAcc][1]);
    INI_WriteInt(File, "BankMoney3", BankInfo[playerid][pBankMoney][2]);
    INI_WriteInt(File, "BankActive3", BankInfo[playerid][pActiveAcc][2]);
    INI_WriteInt(File, "BankMoney4", BankInfo[playerid][pBankMoney][3]);
    INI_WriteInt(File, "BankActive4", BankInfo[playerid][pActiveAcc][3]);
    // Position Saving
    GetPlayerPos(playerid, PlayerInfo[playerid][PlayerPos][0], PlayerInfo[playerid][PlayerPos][1], PlayerInfo[playerid][PlayerPos][2]);
    INI_WriteFloat(File, "PosX", PlayerInfo[playerid][PlayerPos][0]);
    INI_WriteFloat(File, "PosY", PlayerInfo[playerid][PlayerPos][1]);
    INI_WriteFloat(File, "PosZ", PlayerInfo[playerid][PlayerPos][2]);
    INI_Close(File);
    }
    return 1;
}
Okay, so whenever I register it will create my .ini file, etc then I can do whatever, I then LOGOUT and look in my .ini file and all the stuff I did on my account(I.E. Changed my pos) it will create like a new data section:
pawn Код:
[Player Data]
Password = 135660048
Level = 1
Administration = 0
Mail-Box = 0
House Key = -1
VIP Level = 0
Skin ID = 299
Playing Hours = 0
Kills = 0
Deaths = 0
Age = 20
Gender = 1
Job = 0
Job2 = 0
DOBMonth = 3
DOBDate = 4
DOBYear = 1991
BankMoney1 = 0
BankActive1 = 0
BankMoney2 = 0
BankActive2 = 0
BankMoney3 = 0
BankActive3 = 0
BankMoney4 = 0
BankActive4 = 0
[Data]
Level = 1
Administration = 5
Mail-Box = 0
House Key = 0
VIP Level = 0
Skin ID = 0
Playing Hours = 0
Kills = 0
Deaths = 0
Age = 20
Gender = 1
Job = 0
Job2 = 0
DOBMonth = 3
DOBDate = 4
DOBYear = 1991
BankMoney1 = 12132
BankActive1 = 1
BankMoney2 = 1111
BankActive2 = 1
BankMoney3 = 117
BankActive3 = 1
BankMoney4 = 11639
BankActive4 = 1
PosX = 1964.450073
PosY = 1317.059570
PosZ = 9.257812
Thats what happens when I logout, it duplicates(bottom section is the updated one), idk why ;/

Register shiz:
pawn Код:
new INI:File = INI_Open(UserSavePath(playerid));
                INI_SetTag(File, "Player Data");
                INI_WriteInt(File, "Password", TutorialPassword[playerid]);
                INI_WriteInt(File, "Level", PlayerInfo[playerid][pLevel] = 1);
                INI_WriteInt(File, "Administration", PlayerInfo[playerid][pAdmin] = 0);
                INI_WriteInt(File, "Mail-Box", PlayerInfo[playerid][pMailBox] = 0);
                INI_WriteInt(File, "House Key", PlayerInfo[playerid][pHouseKey] = -1);
                INI_WriteInt(File, "VIP Level", PlayerInfo[playerid][pVIP] = 0);
                INI_WriteInt(File, "Skin ID", PlayerInfo[playerid][pSkinID] = 299);
                INI_WriteInt(File, "Playing Hours", PlayerInfo[playerid][pConnectTime] = 0);
                INI_WriteInt(File, "Kills", PlayerInfo[playerid][pKills] = 0);
                INI_WriteInt(File, "Deaths", PlayerInfo[playerid][pDeaths] = 0);
                INI_WriteInt(File, "Age", TutorialAge[playerid]);
                INI_WriteInt(File, "Gender", TutorialGender[playerid]);
                INI_WriteInt(File, "Job", PlayerInfo[playerid][pJob] = 0);
                INI_WriteInt(File, "Job2", PlayerInfo[playerid][pJob2] = 0);
                INI_WriteInt(File, "DOBMonth", TutorialDOBMonth[playerid]);
                INI_WriteInt(File, "DOBDate", TutorialDOBDate[playerid]);
                INI_WriteInt(File, "DOBYear", TutorialDOBYear[playerid]);
                INI_WriteInt(File, "BankMoney1", BankInfo[playerid][pBankMoney][0] = 0);
                INI_WriteInt(File, "BankActive1", BankInfo[playerid][pActiveAcc][0] = 0);
                INI_WriteInt(File, "BankMoney2", BankInfo[playerid][pBankMoney][1] = 0);
                INI_WriteInt(File, "BankActive2", BankInfo[playerid][pActiveAcc][1] = 0);
                INI_WriteInt(File, "BankMoney3", BankInfo[playerid][pBankMoney][2] = 0);
                INI_WriteInt(File, "BankActive3", BankInfo[playerid][pActiveAcc][2] = 0);
                INI_WriteInt(File, "BankMoney4", BankInfo[playerid][pBankMoney][3] = 0);
                INI_WriteInt(File, "BankActive4", BankInfo[playerid][pActiveAcc][3] = 0);
                INI_Close(File);
Sorry for all the code, but any help? :/ Confused the fuck out of me
Reply
#2

Well instead of putting logged in put the whole code onplayerdisconnect and i think u have put the wrong coded use exist
Reply
#3

Quote:

i think u have put the wrong coded use exist

What?
Reply
#4

The tags has to be the same, the first one is Data and the second is Player Data change them,
to be the same.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)