Y_INI House Load
#1

Solved.
Reply
#2

bump nobody knows?
Reply
#3

Is it saving houses correctly so it loads it? Its a custom saving or is saved in Players char?
Reply
#4

Yes everything saves correctly but it doesn't load correctly.

Код:
[house]
Price = 20000
Owned = 1
VirtualWorld = 0
XPos = 2270.474853
YPos = -7.504103
ZPos = 28.153547
Owner = Kevin_Crawford
Reply
#5

pawn Код:
stock LoadHouses()//Creating the stock function
{
    new string[100];
    for(new i = 0; i < MAX_HOUSES; i ++)//Creates a loop, that goes through all of the HOUSES.
    {
        format(string, sizeof(string), "/Houses/HouseID%i.ini", i);//formats the file path, with the biz ID
        INI_ParseFile(string, "housedata", .bExtra = true, .extra = i );//This is very hard to explain, but it basically loads the info from the file(More in ****** y_ini tutorial.)
        HouseEnter[i] = CreateDynamicCP(HInfo[i][XPos], HInfo[i][YPos], HInfo[i][ZPos], 1.5, HInfo[i][VirtualWorld], -1, -1, 2);//Creating the checkpoint and storing it in the HouseEnter value.
        HouseExit[i] = CreateDynamicCP(443.9237, 509.4609, 1001.4195, 1.5, HInfo[i][VirtualWorld], -1, -1, 2);//Creating the house exit checkpoint and storing it in the HouseExit value.
        switch(HInfo[i][Owned])//Using the "switch" method to check if the house is owned
        {
            case 0: format(string, sizeof(string), "Owned: No\nPrice: %i", HInfo[i][Price]);//If it isnt...
            case 1: format(string, sizeof(string), "Owned: Yes\nPrice: %i\nOwner: %s", HInfo[i][Price], HInfo[i][Owner]);//If it is...
        }
        HInfo[i][HouseLabel] = Create3DTextLabel(string, 0xFF0000FF, HInfo[i][XPos], HInfo[i][YPos], HInfo[i][ZPos], 25.0, HInfo[i][VirtualWorld]);//Creating the label with the formatted string.
        HouseCount ++;//+ counting the HouseCount var.
    }
    return 1;
}


forward housedata(id, name[], value[]);
public housedata(id, name[], value[])
{
    INI_Int("Owned", HInfo[id][Owned]);
    INI_Float("XPos", HInfo[id][XPos]);
    INI_Float("YPos", HInfo[id][YPos]);
    INI_Float("ZPos", HInfo[id][ZPos]);
    INI_Int("VirtualWorld", HInfo[id][VirtualWorld]);
    INI_String("Owner", HInfo[id][Owner], 24);
    return 1;
}
Reply
#6

Still not working. I have done printf("Loading house id%d", id); and it doesn't even print it at all i don't think the function is called right but ongamemodeinit i have LoadHouses();
Reply
#7

Runn3R ? YINI Close slowly so it cant be saved while typing in OnGameModeExit or OnFilterScriptExit
Put
pawn Код:
SaveHouse();
in all house commands then it will work for sure
Reply
#8

Yeah it's already like that on every command like (createhouse, buyhouse, sellhouse).

But the loading only seems to be an issue.
Reply
#9

Bump
Reply
#10

Change this:
pawn Код:
forward housedata_id(i, name[], value[]);
public housedata_id(i, name[], value[])
To this:
pawn Код:
forward housedata_data(i, name[], value[]);
public housedata_data(i, name[], value[])
Its should be data, not id.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)