SA-MP Forums Archive
Y_INI House Load - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Y_INI House Load (/showthread.php?tid=518297)



Y_INI House Load - Runn3R - 09.06.2014

Solved.


Re: Y_INI House Load - Runn3R - 10.06.2014

bump nobody knows?


Re: Y_INI House Load - Laure - 10.06.2014

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


Re: Y_INI House Load - Runn3R - 10.06.2014

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



Re: Y_INI House Load - DrakeX - 10.06.2014

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;
}



Re: Y_INI House Load - Runn3R - 10.06.2014

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();


Re: Y_INI House Load - ReD_HunTeR - 10.06.2014

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


Re: Y_INI House Load - Runn3R - 10.06.2014

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

But the loading only seems to be an issue.


Re: Y_INI House Load - Runn3R - 15.06.2014

Bump


Re: Y_INI House Load - RenovanZ - 15.06.2014

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.