30.07.2014, 10:58
Hello guys.I`m working my ass on a script but i`m stuck at LoadBusiness....
The problem is that when I restart the server, businesses doesn`t load, and in business.cfg the description of the biz is 48 and Name of it is 10 o_O.
Here`s the SaveBusiness:
Here is LoadBusiness:
The problem is that when I restart the server, businesses doesn`t load, and in business.cfg the description of the biz is 48 and Name of it is 10 o_O.
Here`s the SaveBusiness:
Код:
SaveBusiness() { new szFileStr[1024], File: fHandle = fopen("business.cfg", io_write); for(new iIndex; iIndex < MAX_BUSINESSES; iIndex++) { format(szFileStr, sizeof(szFileStr), "%d|%s|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%f|%d|%d|%d|%d|%d|%d|%d|%d|%f|%f|%f|%f|%f|%f|%d|%f|%f|%d|%d|%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\r\n", bOwner, bName, bOwnerName, bValue, bType, bLevel, bLevelProgress, bAutoSale, bSafeBalance, bInventory, bInventoryCapacity, bStatus, bRankPay, Float: bExtPosX, Float: bExtPosY, Float: bExtPosZ, Float: bExtPosR, Float: bIntPosX, Float: bIntPosY, Float: bIntPosZ, Float: bIntPosR, Float: bSupplyPosX, Float: bSupplyPosY, Float: bSupplyPosZ, bInt, bVW, bMinInviteRank, bMinGiveRankRank, bMinSupplyRank, bMinSafeRank, bMinInventoryRank, bMinStatusRank, bMinDoorRank, bGunsOffered, bSkinsOffered, bToysOffered, bItemPrices, bTotalSales, bTotalProfits, //Text3D: bStateText, //Text3D: bDoorText, //Text3D: bSupplyText, bPickup, bAutoPay, Float: bGasPrice, bStrictPrice, bOrderBy, bOrderState, bOrderAmount, bOrderDate, bCustomExterior, bCustomInterior, bGrade, Float: GasPumpPosX, Float: GasPumpPosY, Float: GasPumpPosZ, Float: GasPumpAngle, Float: GasPumpCapacity, Float: GasPumpGallons, GasPumpObjectID, //Text3D: GasPumpInfoTextID, //Text3D: GasPumpSaleTextID, Float: GasPumpSaleGallons, Float: GasPumpSalePrice, GasPumpTimer, GasPumpVehicleID, Float: bParkPosX, Float: bParkPosY, Float: bParkPosZ, Float: bParkAngle, Float: bPurchaseX, Float: bPurchaseY, Float: bPurchaseZ, Float: bPurchaseAngle, bColor1, bColor2, bModel, bPrice, Float: bHealth, Float: bFuel, Lock, bVehID, DealershipVehStock, DealershipVehOrder, //Text3D:bVehicleLabel, bMonths, bGymEntryFee, bGymType, // 1 = swimming pool bGymBoxingArena1, bGymBoxingArena2, bGymBikePlayers, bGymBikeVehicles ); fwrite(fHandle, szFileStr); } return fclose(fHandle); }
Код:
LoadBusiness() { if(!fexist("business.cfg")) return 1; new szFileStr[1024], File: iFileHandle = fopen("business.cfg", io_read), idx; while(idx < sizeof(HouseInfo) && fread(iFileHandle, szFileStr)) { sscanf(szFileStr, "p<|>is[128]s[24]iiiiiiiiiifffffffffffiiiiiiiiiiiiiiiiifiiiiiiiiffffffiffiiffffffffiiiiffiiiiiiiiii", Businesses[idx][bOwner], Businesses[idx][bName], Businesses[idx][bOwnerName], Businesses[idx][bValue], Businesses[idx][bType], Businesses[idx][bLevel], Businesses[idx][bLevelProgress], Businesses[idx][bAutoSale], Businesses[idx][bSafeBalance], Businesses[idx][bInventory], Businesses[idx][bStatus], Businesses[idx][bRankPay], Businesses[idx][bExtPosX], Businesses[idx][bExtPosY], Businesses[idx][bExtPosZ], Businesses[idx][bExtPosR], Businesses[idx][bIntPosX], Businesses[idx][bIntPosY], Businesses[idx][bIntPosZ], Businesses[idx][bIntPosR], Businesses[idx][bSupplyPosX], Businesses[idx][bSupplyPosY], Businesses[idx][bSupplyPosZ], Businesses[idx][bInt], Businesses[idx][bVW], Businesses[idx][bMinInviteRank], Businesses[idx][bMinGiveRankRank], Businesses[idx][bMinSupplyRank], Businesses[idx][bMinSafeRank], Businesses[idx][bMinInventoryRank], Businesses[idx][bMinStatusRank], Businesses[idx][bMinDoorRank], Businesses[idx][bGunsOffered], Businesses[idx][bSkinsOffered], Businesses[idx][bToysOffered], Businesses[idx][bItemPrices], Businesses[idx][bTotalSales], Businesses[idx][bTotalProfits], Businesses[idx][bPickup], Businesses[idx][bAutoPay], Businesses[idx][bGasPrice], Businesses[idx][bStrictPrice], Businesses[idx][bOrderBy], Businesses[idx][bOrderState], Businesses[idx][bOrderAmount], Businesses[idx][bOrderDate], Businesses[idx][bCustomExterior], Businesses[idx][bCustomInterior], Businesses[idx][bGrade], Businesses[idx][GasPumpPosX], Businesses[idx][GasPumpPosY], Businesses[idx][GasPumpPosZ], Businesses[idx][GasPumpAngle], Businesses[idx][GasPumpGallons], Businesses[idx][GasPumpObjectID], Businesses[idx][bCustomInterior], Businesses[idx][GasPumpSaleGallons], Businesses[idx][GasPumpSalePrice], Businesses[idx][GasPumpTimer], Businesses[idx][GasPumpVehicleID], Businesses[idx][bParkPosX], Businesses[idx][bParkPosY], Businesses[idx][bParkPosZ], Businesses[idx][bParkAngle], Businesses[idx][bPurchaseX], Businesses[idx][bPurchaseY], Businesses[idx][bPurchaseZ], Businesses[idx][bPurchaseAngle], Businesses[idx][bColor1], Businesses[idx][bColor2], Businesses[idx][bModel], Businesses[idx][bPrice], Businesses[idx][bHealth], Businesses[idx][bFuel], Businesses[idx][Lock], Businesses[idx][bVehID], Businesses[idx][DealershipVehStock], Businesses[idx][DealershipVehOrder], Businesses[idx][bMonths], Businesses[idx][bGymEntryFee], Businesses[idx][bGymType], Businesses[idx][bGymBoxingArena1], Businesses[idx][bGymBoxingArena2], Businesses[idx][bGymBikePlayers], Businesses[idx][bGymBikeVehicles] ); if (!(Businesses[idx][bExtPosX] == 0.0 && Businesses[idx][bExtPosY] == 0.0 && Businesses[idx][bExtPosZ] == 0.0)) { new string[128]; Businesses[idx][bPickup] = CreateDynamicPickup(GetBusinessDefaultPickup(idx), 23, Businesses[idx][bExtPosX], Businesses[idx][bExtPosY], Businesses[idx][bExtPosZ]); if (Businesses[idx][bOwner] < 1) { format(string,sizeof(string),"%s\n\nBusiness For Sale!\nCost: %s\nTo buy this business type /buybiz\nID: %d", GetBusinessTypeName(Businesses[idx][bType]), number_format(Businesses[idx][bValue]), idx); } else { if(Businesses[idx][bType] != BUSINESS_TYPE_GYM) { format(string,sizeof(string),"%s\n\n%s [Owner: %s]\nID: %d", GetBusinessTypeName(Businesses[idx][bType]), Businesses[idx][bName], StripUnderscore(Businesses[idx][bOwnerName]), idx); } else { format(string,sizeof(string),"%s\n\n%s [Owner: %s]\nID: %d\nGym Entrance: $%s", GetBusinessTypeName(Businesses[idx][bType]), Businesses[idx][bName], StripUnderscore(Businesses[idx][bOwnerName]), idx, number_format(Businesses[idx][bGymEntryFee])); } } Businesses[idx][bDoorText] = CreateDynamic3DTextLabel(string, BUSINESS_NAME_COLOR, Businesses[idx][bExtPosX], Businesses[idx][bExtPosY], Businesses[idx][bExtPosZ] + 0.85, 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1); Businesses[idx][bStateText] = CreateDynamic3DTextLabel((Businesses[idx][bStatus]) ? ("Open") : ("Closed"), (Businesses[idx][bStatus]) ? BUSINESS_OPEN_COLOR : BUSINESS_CLOSED_COLOR, Businesses[idx][bExtPosX], Businesses[idx][bExtPosY], Businesses[idx][bExtPosZ] + 1.05, 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1); format(string,sizeof(string),"%s\nSupply Delivery Point", Businesses[idx][bName]); Businesses[idx][bSupplyText] = CreateDynamic3DTextLabel(string, BUSINESS_NAME_COLOR, Businesses[idx][bSupplyPosX], Businesses[idx][bSupplyPosY], Businesses[idx][bSupplyPosZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1); } ++idx; } return fclose(iFileHandle); }