17.11.2013, 10:27
that makes sense. I have no idea why do I have new idx = 1, and then checking if idx == 1. Thanks, I will try it
EDIT: should I write it like this
I think that will write each time I save businesses another lines with the same things
EDIT: should I write it like this
pawn Код:
stock SaveBiz()
{
if(!fexist("biz.cfg")) fcreate("biz.cfg");
new idx = 1, File:file;
new string[256];
while(idx < MAX_BIZ)
{
format(string, sizeof(string), "%d|%d|%s|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%s\r\n", BizInfo[idx][bType], BizInfo[idx][bStatus], BizInfo[idx][bOwner], BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ], BizInfo[idx][bMoney], BizInfo[idx][bProducts], BizInfo[idx][bSold], BizInfo[idx][bLevel], BizInfo[idx][bPrice], BizInfo[idx][bAP], BizInfo[idx][bTake], BizInfo[idx][bName]);
file = fopen("biz.cfg", io_write);
fwrite(file, string);
fclose(file);
idx++;
}
print("Businesses saved successfully.");
}