help with this please
#7

I've noticed that when I create a clan it saves to the file wrong, it doesnt show the clan name in the file, that is the problem..

Here is my saveclans/loadclans

pawn Код:
forward LoadClans();
public LoadClans()
{
    new arrCoords[4][64];
    new strFromFile2[256];
    new File: file = fopen("Clans/clans.cfg",io_read);
    if (file)
    {
        new idx;
        while (idx < sizeof(Clans))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            strmid(Clans[idx][cName], arrCoords[0], 0, strlen(arrCoords[0]), 255);
            strmid(Clans[idx][clOwner], arrCoords[1], 0, strlen(arrCoords[1]), 255);
            Clans[idx][Front] = strval(arrCoords[2]);
            Clans[idx][Back] = strval(arrCoords[3]);
            idx++;
        }
        fclose(file);
    }

    return 1;
}
forward SaveClans();
public SaveClans()
{
    new idx;
    new File: file2;
    while (idx < sizeof(Clans))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%s|%s|%d|%d\n",
        Clans[idx][cName],
        Clans[idx][clOwner],
        Clans[idx][Front],
        Clans[idx][Back]);
        if(idx == 0)
        {
            file2 = fopen("Clans/clans.cfg",io_write);
        }
        else
        {
            file2 = fopen("Clans/clans.cfg",io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}
Can anyone make it to dini?
Reply


Messages In This Thread
help with this please - by xir - 17.03.2011, 14:12
Re: help with this please - by xir - 20.03.2011, 17:47
Re: help with this please - by xir - 21.03.2011, 14:38
AW: help with this please - by Pablo Borsellino - 21.03.2011, 15:04
Re: help with this please - by xir - 21.03.2011, 15:05
Re: help with this please - by xir - 24.03.2011, 15:22
Re: help with this please - by xir - 25.03.2011, 13:08
Re: help with this please - by xir - 25.03.2011, 18:59
Re: help with this please - by MadeMan - 25.03.2011, 19:13
Re: help with this please - by xir - 25.03.2011, 19:21

Forum Jump:


Users browsing this thread: 1 Guest(s)