Saving .cfg
#1

HI,

i have a proble, he do not save my .cfg

I use OnLeaderUPdate, everytime i change something with /makieleader or sth.
pawn Код:
public OnLeaderUpdate()
{
    if(TOGGLE_DEBUG_MODE)
    {
        print(" //DEBUG: CALL OnLeaderUpdate()");
    }

    new idx;
    new File: file2;
    while (idx < sizeof(LeaderInfo))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%s|%d|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
        LeaderInfo[idx][lFaction],
        LeaderInfo[idx][lMember],
        LeaderInfo[idx][lName],
        LeaderInfo[idx][lLastLoginDay],
        LeaderInfo[idx][lLastLoginMonth],
        LeaderInfo[idx][lLastLoginYear],
        LeaderInfo[idx][lLastLoginHour],
        LeaderInfo[idx][lLastLoginMinute],
        LeaderInfo[idx][lLastLoginSecond],
        LeaderInfo[idx][lInviteDay],
        LeaderInfo[idx][lInviteMonth],
        LeaderInfo[idx][lInviteYear]);
        if(idx == 0)
        {
            file2 = fopen("leader.cfg", io_write);
        }
        else
        {
            file2 = fopen("leader.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    idx = 0;
    return 1;
}
pawn Код:
public LoadLeader()
{
    if(TOGGLE_DEBUG_MODE)
    {
        print(" //DEBUG: CALL LoadLeader()");
    }

    new arrCoords[12][64];
    new strFromFile2[256];
    new File: file = fopen("leader.cfg", io_read);
    if (file)
    {
        new idx;
        while (idx < sizeof(LeaderInfo))
        {
          split(strFromFile2, arrCoords, '|');
          strmid(LeaderInfo[idx][lFaction], arrCoords[0], 0, strlen(arrCoords[0]), 255);
          LeaderInfo[idx][lMember] = strval(arrCoords[1]);
          strmid(LeaderInfo[idx][lName], arrCoords[2], 0, strlen(arrCoords[2]), 255);
          LeaderInfo[idx][lLastLoginDay] = strval(arrCoords[3]);
          LeaderInfo[idx][lLastLoginMonth] = strval(arrCoords[4]);
          LeaderInfo[idx][lLastLoginYear] = strval(arrCoords[5]);
          LeaderInfo[idx][lLastLoginHour] = strval(arrCoords[6]);
          LeaderInfo[idx][lLastLoginMinute] = strval(arrCoords[7]);
          LeaderInfo[idx][lLastLoginSecond] = strval(arrCoords[8]);
          LeaderInfo[idx][lInviteDay] = strval(arrCoords[9]);
          LeaderInfo[idx][lInviteMonth] = strval(arrCoords[10]);
          LeaderInfo[idx][lInviteYear] = strval(arrCoords[11]);
            printf("FactionID:%d Owner:%s Member: %d.\n",
            idx,
            LeaderInfo[idx][lName],
            LeaderInfo[idx][lMember]);
            idx++;
        }
        fclose(file);
    }
    return 1;
}

Reply
#2

....
Reply
#3

Don't work, maybe with MYSQL?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)