Licenses using yINI
#1

hey.. I've worked on the licenses system... like driving test and all that
but.. the problem I'm having is everytime players login he gets 5 new lines in his player file..

I've got those under: enum pInfo:

pVehLic,
phVehLic,
pFlyLic,
pSailLic,
pGunLic,

and the rest are the same like all the things under it.. i mean.. its written under disconnect and under LoadUser_Data

if someone understands and can help me just tell me what to copy to here and i'll do it

Thanks



EDIT:

I've tested it more ... and I've understood that everytime i log out its write the whole things all over again..
Reply
#2

I will tell you why.

It's because you forgot to use INI_SetTag(File, "Data"); that's just an example.

Go and find your register command you should find "INI_SetTag".
Reply
#3

I'm using it...

INI_SetTag(File,"data");


maybe something else?
someone?
Reply
#4

Show the code.
Reply
#5

No problem.. but what part?

pawn Код:
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Level",PlayerInfo[playerid][pLevel]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Helper",PlayerInfo[playerid][pHelper]);
    INI_Int("AdminOnDuty",PlayerInfo[playerid][pAOnDuty]);
    INI_Int("Sex",PlayerInfo[playerid][pSex]);
    INI_Int("Age",PlayerInfo[playerid][pAge]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Tutorial",PlayerInfo[playerid][pTut]);
    INI_Int("Muted",PlayerInfo[playerid][pMute]);
    INI_Int("Leader",PlayerInfo[playerid][pLeader]);
    INI_Int("Member",PlayerInfo[playerid][pMember]);
    INI_Int("Rank",PlayerInfo[playerid][pRank]);
    INI_Int("Model",PlayerInfo[playerid][pModel]);
    INI_Int("Char",PlayerInfo[playerid][pChar]);
    INI_Int("Vehicle License",PlayerInfo[playerid][pVehLic]);
    INI_Int("Heavy Vehicle License",PlayerInfo[playerid][phVehLic]);
    INI_Int("Flying License",PlayerInfo[playerid][pFlyLic]);
    INI_Int("Sailing License",PlayerInfo[playerid][pSailLic]);
    INI_Int("Gun License",PlayerInfo[playerid][pGunLic]);
    return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
    if(IsADMV(GetPlayerVehicleID(playerid)))
    {
        DrivingTest[playerid] = 0;
        DisablePlayerCheckpoint(playerid);
        SetVehicleToRespawn(GetPlayerVehicleID(playerid));
    }
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Helper",PlayerInfo[playerid][pHelper]);
    INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
    INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Tutorial",PlayerInfo[playerid][pTut]);
    INI_WriteInt(File,"Muted",PlayerInfo[playerid][pMute]);
    INI_WriteInt(File,"Leader",PlayerInfo[playerid][pLeader]);
    INI_WriteInt(File,"Member",PlayerInfo[playerid][pMember]);
    INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
    INI_WriteInt(File,"Model",PlayerInfo[playerid][pModel]);
    INI_WriteInt(File,"Char",PlayerInfo[playerid][pChar]);
    INI_WriteInt(File,"Vehicle License",PlayerInfo[playerid][pVehLic]);
    INI_WriteInt(File,"Heavy Vehicle License",PlayerInfo[playerid][phVehLic]);
    INI_WriteInt(File,"Flying License",PlayerInfo[playerid][pFlyLic]);
    INI_WriteInt(File,"Sailing License",PlayerInfo[playerid][pSailLic]);
    INI_WriteInt(File,"Gun License",PlayerInfo[playerid][pGunLic]);
    INI_Close(File);
    return 1;
}
Reply
#6

all you need to do is

pawn Код:
PlayerInfo[playerid][pVehLic] == 1;
then save on disconnect
Reply
#7

But I know that.. i didnt say it dont work..
i said. that everytime i log out.. its write again on the user files... then i get multiple lines of the same shit!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)