Little help overwriting a line of a file
#6

I've tried putting it on a different way.
Like this:

pawn Код:
function LastHouseUpdates()
{
    new x;
    new File: file2;
    while (x < sizeof(HSaveInfo))
    {
        new sstring[256];
        format(sstring, sizeof(sstring), "GunShop:%d - Date:%02d|%02d|%d\n",HSaveInfo[x][sID],HSaveInfo[x][sDay],HSaveInfo[x][sMonth],HSaveInfo[x][sYear]);
        if(x == 0)
        {
            file2 = fopen("guns.cfg", io_write);
        }
        else
        {
            file2 = fopen("guns.cfg", io_append);
        }
        fwrite(file2, sstring);
        x++;
        fclose(file2);
    }
    return 1;
}
I have this at the cmd /enter:

pawn Код:
getdate(HSaveInfo[i][sYear], HSaveInfo[i][sMonth], HSaveInfo[i][sDay]);
HSaveInfo[i][sID] = i;
LastHouseUpdates();
This all works, but there's only one problem. I need to make a way to load the file and the data that is saved in it. But I don't know how. Because at the moment the entered Gunshop is being saved correctly on its line, but the rest of the Gunshops are assuming zero. Every other line a 0;

Example, I entered the Gunshop id:2
And this happened:

Before:
GunShop:0 - Date:10|03|2000
GunShop:1 - Date:10|03|2000
GunShop:2 - Date:10|03|2000
GunShop:3 - Date:10|03|2000
GunShop:4 - Date:10|03|2000
GunShop:5 - Date:10|03|2000

After:
GunShop:0 - Date:00|00|00
GunShop:1 - Date:31|05|2012
GunShop:2 - Date:00|00|00
GunShop:3 - Date:00|00|00
GunShop:4 - Date:00|00|00
GunShop:5 - Date:00|00|00

Please help anybody. :\
Reply


Messages In This Thread
Little help overwriting a line of a file - by Mishima - 29.05.2012, 19:21
Re: Little help overwriting a line of a file - by Jonny5 - 29.05.2012, 20:05
Re: Little help overwriting a line of a file - by Mishima - 29.05.2012, 20:31
Re: Little help overwriting a line of a file - by Mishima - 30.05.2012, 11:36
Re: Little help overwriting a line of a file - by Jonny5 - 30.05.2012, 11:45
Re: Little help overwriting a line of a file - by Mishima - 31.05.2012, 14:00
Re: Little help overwriting a line of a file - by MadeMan - 31.05.2012, 16:15
Re: Little help overwriting a line of a file - by Mishima - 31.05.2012, 16:50

Forum Jump:


Users browsing this thread: 4 Guest(s)