04.01.2016, 16:40
Код:
stock SaveBusiness() { if(!fexist("business.cfg")) fcreate("business.cfg"); new idx = 1, File:file; new string[128], string1[256]; while(idx < MAX_BIZ) { format(string1, sizeof(string1), "%d|%d|%s|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|", 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][bCellphone], BizInfo[idx][bPhonebook], BizInfo[idx][bDice], BizInfo[idx][bCigar], BizInfo[idx][bSprunk], BizInfo[idx][bSpraycan]); strcat(string, string1, sizeof(string1)); format(string1, sizeof(string1), "%d|%d|%d|%d|%d|%d|%d|%d|%d|%s\r\n", BizInfo[idx][bRope], BizInfo[idx][bMask], BizInfo[idx][bBlindfold], BizInfo[idx][bWalkietalkie], BizInfo[idx][bMP3], BizInfo[idx][bCamera], BizInfo[idx][bGascan], BizInfo[idx][bBoombox], BizInfo[idx][bSpeedo], BizInfo[idx][bMessage]); strcat(string, string1, sizeof(string1); if(idx == 1) { file = fopen("business.cfg", io_write); } else { file = fopen("business.cfg", io_append); } fwrite(file, string); fclose(file); idx+; } print("Businesses saved successfully."); }