Need urgent help.
#1

Hello again.

I need a help to fix this issue, i have been trying to fix it since 1 week now but no luck. I had recently posted a topic for same stuff but i didn't understand properly from what ****** posted there. So, instead of bumping that thread i thought of making a new one with the code i have.

The problem is, the vehicles that player bought are not loading when player connects to the server. Only house data loads but not vehicles.

These are the code:

Saving house and vehicle data:
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]);
    //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]);
            INI_WriteInt(HFile, "VehicleHood", gVehicleInfo[vid][Components][1]);
            INI_WriteInt(HFile, "VehicleRoof", gVehicleInfo[vid][Components][2]);
            //More bellow
        }
    }
    INI_Close(HFile);
}
Loading functions:
pawn Код:
Function:LoadHouse_data(HouseID, name[], value[])
{
    INI_String("HouseName", gHouseData[HouseID][HouseName], 100);
    INI_Float("HouseX", gHouseData[HouseID][HouseX]);
    INI_Float("HouseY", gHouseData[HouseID][HouseY]);
    INI_Float("HouseZ", gHouseData[HouseID][HouseZ]);
    INI_Int("HouseLevel", gHouseData[HouseID][HouseLevel]);
    //More bellow
    return 1;
}

Function:LoadVehicles_data(vid, name[], value[])
{
    INI_Int("VehicleModel", gVehicleInfo[vid][Model]);
    INI_Int("Fuel", gVehicleInfo[vid][Fuel]);
    INI_Int("VehiclePaintJob", gVehicleInfo[vid][PaintJob]);
    INI_Int("VehicleSpoiler", gVehicleInfo[vid][Components][0]);
    INI_Int("VehicleHood", gVehicleInfo[vid][Components][1]);
    INI_Int("VehicleRoof", gVehicleInfo[vid][Components][2]);
    //More bellow
    return 1;
}
And this is the function to load them differently in different callbacks
pawn Код:
Housing_LoadAll(HouseID, bool:OnlyVehicles = false)
{
    if(fexist(House_Directory(HouseID)))
    {
        if(OnlyVehicles == false)
        {
            INI_ParseFile(House_Directory(HouseID), "LoadHouse_%s", .bExtra = true, .extra = HouseID, .bFilter = true, .filter = "House");
            House_CreateEntrance(HouseID);
            gHouseData[HouseID][HouseOpened] = false;
            TotalHouses++;
        }
        else
        {
            new
                vid;
               
            for (new v_index; v_index < 10; v_index++)
            {
                if (gHouseData[HouseID][VehicleIDs][v_index] != 0)
                {
                    vid = gHouseData[HouseID][VehicleIDs][v_index];

                    INI_ParseFile(House_Directory(HouseID), "LoadVehicles_%s", .bExtra = true, .extra = HouseID, .bFilter = true, .filter = "Vehicles");
                    House_AddVehicle(HouseID,  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]);
                }
            }
        }
    }
}
The House_LoadAll(HouseID); goes inside OnGameModeInit() and Housing_LoadAll(HouseID, true); goes to OnPlayerConnect callback.

Normal house data just loads fine in OnGameModeInit callback but vehicle data refuses to load in OnPlayerConnect.

Please someone help me to fix this, its important

These are the stuffs i got inside the house file

Код:
[@@House-data]
HouseName = {FFFFFF}House of Shubham
HouseX = 1463.220703
HouseY = 1001.149169
HouseZ = 10.820312
HouseLevel = 1
[@@Vehicles-data]
VehicleModel = 560
Fuel = 5986
Color1 = -1
Color2 = -1
VehicleX = 1451.905273
VehicleY = 1003.708618
VehicleZ = 10.525576
VehicleAngle = 173.947708
Clamped = false
The code was suppose to load different tags in two different callbacks. House inside OnGameModeInit and Vehicles inside OnPlayerConnect.
Reply
#2

/Bump, no one knows? D:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)