Object won't delete
#3

Thanks, fixed it. But now there's another problem. variable in enum got mixed up with my note variable.

When I print(pInfo[playerid][pAdminLevel]);, it shows me a content of Note1 variable.

This is how I load them:

pawn Код:
public LoadPlayer(playerid)
{
    new usfile[128];
    format(usfile, sizeof(usfile), "Accounts/%s.ini", pName[playerid]);
   
    new File:UserFile = fopen(usfile, io_read); // Open the file
    new key[256], val[256];
    new Data[256];
    if(UserFile){
        while (fread(UserFile, Data, sizeof(Data)))
        { // LOAD FROM ORIGIONAL USERFILES
            key = ini_GetKey(Data);
            if(strcmp(key ,"Faction" ,true ) == 0) { val = ini_GetValue(Data); pInfo[playerid][fsFaction] = strval(val);}
            if(strcmp(key ,"AdminLevel" ,true ) == 0) { val = ini_GetValue(Data); pInfo[playerid][pAdminLevel] = strval(val);}
        }
        fclose(UserFile);
    }
   
    format(usfile, sizeof(usfile), "AccountsUpdate/%s.ini", pName[playerid]);
    UserFile = fopen(usfile, io_read); // Open the file
   
    if(UserFile){
        while (fread(UserFile, Data, sizeof(Data)))
        { // LOAD FROM NEW USERFILES FOR UPDATES
            key = ini_GetKey(Data);
            if(strcmp(key ,"Note1" ,true ) == 0) { val = ini_GetValue(Data); strmid(pInfo[playerid][pNote1],val,0,strlen(val)-1,32);}
            if(strcmp(key ,"Note2" ,true ) == 0) { val = ini_GetValue(Data); strmid(pInfo[playerid][pNote2],val,0,strlen(val)-1,32);}
            if(strcmp(key ,"Note3" ,true ) == 0) { val = ini_GetValue(Data); strmid(pInfo[playerid][pNote3],val,0,strlen(val)-1,32);}
            if(strcmp(key ,"Note4" ,true ) == 0) { val = ini_GetValue(Data); strmid(pInfo[playerid][pNote4],val,0,strlen(val)-1,32);}
            if(strcmp(key ,"Note5" ,true ) == 0) { val = ini_GetValue(Data); strmid(pInfo[playerid][pNote5],val,0,strlen(val)-1,32);}
        }
        fclose(UserFile);
    }
}
Note1 variable somehow got into the pAdminLevel variable.

This is my enum:
pawn Код:
enum pInformation
{
    pAdminLevel,
    fsFaction,
    pNote1[100],
    pNote2[100],
    pNote3[100],
    pNote4[100],
    pNote5[100]
}
new pInfo[MAX_PLAYERS][pInformation];
Reply


Messages In This Thread
Object won't delete - by Outcast - 08.01.2012, 15:32
Re: Object won't delete - by BlackWolf120 - 08.01.2012, 15:40
Re: Object won't delete - by Outcast - 08.01.2012, 16:08

Forum Jump:


Users browsing this thread: 1 Guest(s)