31.05.2012, 14:00
I've tried putting it on a different way.
Like this:
I have this at the cmd /enter:
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. :\
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;
}
pawn Код:
getdate(HSaveInfo[i][sYear], HSaveInfo[i][sMonth], HSaveInfo[i][sDay]);
HSaveInfo[i][sID] = i;
LastHouseUpdates();
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. :\