Y_Ini tag
#9

Ok, after reading that i have tried doing it like this

While saving:
pawn Код:
HouseFile_Save(HouseID)
{
    new
        INI:HFile = INI_Open(House_Directory(HouseID)),
        vid
    ;

    INI_SetTag(HFile, "@@House-data");
    INI_WriteString(HFile, "HouseName", gHouseData[HouseID][HouseName]);
    INI_WriteFloat(HFile, "HouseX", gHouseData[HouseID][HouseX]);
    INI_WriteFloat(HFile, "HouseY", gHouseData[HouseID][HouseY]);
    //more bellow
    for (new v_index; v_index < 10; v_index++)
    {
        if (gHouseData[HouseID][VehicleIDs][v_index] != 0)
        {
            vid = gHouseData[HouseID][VehicleIDs][v_index];
            INI_SetTag(HFile, "@@Vehicles-data");
            INI_WriteInt(HFile, "VehicleModel", gVehicleInfo[vid][Model]);
            INI_WriteInt(HFile, "Fuel", gVehicleInfo[vid][Fuel]);
            INI_WriteInt(HFile, "VehiclePaintJob", gVehicleInfo[vid][PaintJob]);
            INI_WriteInt(HFile, "VehicleSpoiler", gVehicleInfo[vid][Components][0]);
            //more bellow
        }
    }
    INI_Close(HFile);
}
pawn Код:
//This goes under OnGameModeInit()
Housing_LoadAll()
{
    for(new HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
    {
        if(fexist(House_Directory(HouseID)))
        {
            INI_ParseFile(House_Directory(HouseID), "LoadHouse_%s", .bExtra = true, .extra = HouseID, .bFilter = true, .filter = "House");
            House_CreateEntrance(HouseID);
            gHouseData[HouseID][HouseOpened] = false;
            TotalHouses++;
        }
    }
}
pawn Код:
//This goes under OnPlayerConnect
    new
        house_id = pInfo[playerid][pHouse_ID];

    if (house_id != 0)
    {
        if(fexist(House_Directory(house_id)))
        {
            INI_ParseFile(House_Directory(house_id), "LoadHouse_%s", .bExtra = true, .extra = house_id, .bFilter = true, .filter = "Vehicles");

            for (new v_index; v_index < 10; v_index++)
            {
                if(gHouseData[house_id][VehicleIDs][v_index] != 0)
                {
                    vid = gHouseData[house_id][VehicleIDs][v_index];

                    House_AddVehicle(house_id,  gVehicleInfo[vid][Model], gVehicleInfo[vid][PaintJob], gVehicleInfo[vid][Components], gVehicleInfo[vid][SpawnX], gVehicleInfo[vid][SpawnY], gVehicleInfo[vid][SpawnZ], gVehicleInfo[vid][SpawnRot],  gVehicleInfo[vid][Color1], gVehicleInfo[vid][Color2]);
                    gVehicleInfo[vid][Clamped] = gVehicleInfo[vid][Clamped];

                    if (gVehicleInfo[vid][Fuel] == -1)
                        gVehicleInfo[vid][Fuel] = MAX_FUEL;
                    else
                        gVehicleInfo[vid][Fuel] = gVehicleInfo[vid][Fuel];
                }
            }
        }
    }
But these code didn't work. House loads fine but not the vehicles. Is there something wrong? Help please. And sorry for posting huge stuffs.
Reply


Messages In This Thread
Y_Ini tag - by iOxide - 01.10.2014, 11:01
Re: Y_Ini tag - by dusk - 01.10.2014, 11:32
Re: Y_Ini tag - by iOxide - 01.10.2014, 11:43
Re: Y_Ini tag - by iOxide - 02.10.2014, 18:53
Re: Y_Ini tag - by Evocator - 02.10.2014, 19:07
Re: Y_Ini tag - by iOxide - 05.10.2014, 14:22
Re: Y_Ini tag - by RoW001 - 05.10.2014, 14:36
Re: Y_Ini tag - by iOxide - 05.10.2014, 14:43
Re: Y_Ini tag - by iOxide - 05.10.2014, 19:03

Forum Jump:


Users browsing this thread: 3 Guest(s)