INI_ParseFile doesn't load houses..
#1

Ok I'm sick of this please help me I tried to make Loading for houses
It doesn't load the houses, I made Debug with creating Pickups/Labels to print if House is OWNED, Made 4 houses
1.ini, 2.ini, 3.ini, 4.ini
(1 = non-owned | 2 = owned | 3 = non-owned | 4 = owned)

It prints:
PHP код:
[DEBUG]:  House 1 Pickup-And-Label Created! (NON-OWNED)
[
DEBUG]:  House 2 Pickup-And-Label Created! (NON-OWNED)
[
DEBUG]:  House 3 Pickup-And-Label Created! (NON-OWNED)
[
DEBUG]:  House 4 Pickup-And-Label Created! (NON-OWNED
By default ( NON-LOADED ) HouseOwned is set to 0,
(Doesn't print "House %d Loaded", also made Debug for loading)
so it doesn't load the houses..

pawn Код:
forward LoadAllHouses();
public LoadAllHouses()
{
    for(new i = 1; i < sizeof(HouseInfo); i++)
    {
        INI_ParseFile(HousePath(i), "LoadHouse_%i", .bExtra = true, .extra = i);
    }
}

public LoadHouse_data(idx, name[], value[])
{

    INI_Int("Owned", HouseInfo[idx][hOwned]);
    INI_String("Owner", HouseInfo[idx][hOwner], MAX_PLAYER_NAME);
    INI_Int("Price", HouseInfo[idx][hPrice]);
    INI_Int("Level", HouseInfo[idx][hLevel]);
    INI_Int("Locked", HouseInfo[idx][hLocked]);
    INI_Float("EntranceX", HouseInfo[idx][hEntrancex]);
    INI_Float("EntranceY", HouseInfo[idx][hEntrancey]);
    INI_Float("EntranceZ", HouseInfo[idx][hEntrancez]);
    INI_Float("ExitX", HouseInfo[idx][hExitx]);
    INI_Float("ExitY", HouseInfo[idx][hExity]);
    INI_Float("ExitZ", HouseInfo[idx][hExitz]);
    INI_Int("Interior", HouseInfo[idx][hInt]);
    INI_Int("World", HouseInfo[idx][hWorld]);
           
    printf("House %d loaded",idx);

    return 1;
}

forward CreateHouseLabelsPickups();
public CreateHouseLabelsPickups()
{
    new fstring[64];
    for(new idx = 1; idx < sizeof(HouseInfo); idx++)
    {
        format(fstring, 64, HOUSEPATH, idx);
        if(fexist(fstring))
        {
            if(HouseInfo[idx][hOwned] == 1)
            {
                HouseInfo[idx][hPickup] = CreateDynamicPickup(1239, 1, HouseInfo[idx][hEntrancex], HouseInfo[idx][hEntrancey], HouseInfo[idx][hEntrancez], 0);
                new labelstring[128];
                format(labelstring, sizeof(labelstring),"{F0C948}House owner: {FFFFFF}%s\n{F0C948}Level: {FFFFFF}%d",HouseInfo[idx][hOwner], HouseInfo[idx][hLevel]);
                HouseInfo[idx][sLabel] = CreateDynamic3DTextLabel(labelstring, 0xAAAAAAFF, HouseInfo[idx][hEntrancex], HouseInfo[idx][hEntrancey], HouseInfo[idx][hEntrancez], 10.0);
                        printf("House %d Pickup-And-Label Created! (OWNED)", idx);
            }

            else if(HouseInfo[idx][hOwned] == 0)
            {
                HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hEntrancex], HouseInfo[idx][hEntrancey], HouseInfo[idx][hEntrancez], 0);
                new labelstring2[128];
                format(labelstring2, sizeof(labelstring2),"{F0C948}House for sale!\nPrice: {FFFFFF}%d\n{F0C948}Level: {FFFFFF}%d",HouseInfo[idx][hPrice], HouseInfo[idx][hLevel]);
                HouseInfo[idx][sLabel] = CreateDynamic3DTextLabel(labelstring2, 0xAAAAAAFF, HouseInfo[idx][hEntrancex], HouseInfo[idx][hEntrancey], HouseInfo[idx][hEntrancez], 10.0);
                        printf("House %d Pickup-And-Label Created! (NON-OWNED)", idx);
            }
        }
    }
    KillTimer(house_timer);
}
Reply
#2

Bump please help
Reply
#3

For INI sake help me someone this thread has been bumped from the grave :/
Reply
#4

LoadHouse_%i must be LoadHouse_%s.

Try this:

pawn Код:
forward LoadAllHouses();
public LoadAllHouses()
{
    for(new i = 1; i < sizeof(HouseInfo); i++)
    {
        INI_ParseFile(HousePath(i), "LoadHouse_%s", .bExtra = true, .extra = i);
    }
}

public LoadHouse_data(idx, name[], value[])
{

    INI_Int("Owned", HouseInfo[idx][hOwned]);
    INI_String("Owner", HouseInfo[idx][hOwner], MAX_PLAYER_NAME);
    INI_Int("Price", HouseInfo[idx][hPrice]);
    INI_Int("Level", HouseInfo[idx][hLevel]);
    INI_Int("Locked", HouseInfo[idx][hLocked]);
    INI_Float("EntranceX", HouseInfo[idx][hEntrancex]);
    INI_Float("EntranceY", HouseInfo[idx][hEntrancey]);
    INI_Float("EntranceZ", HouseInfo[idx][hEntrancez]);
    INI_Float("ExitX", HouseInfo[idx][hExitx]);
    INI_Float("ExitY", HouseInfo[idx][hExity]);
    INI_Float("ExitZ", HouseInfo[idx][hExitz]);
    INI_Int("Interior", HouseInfo[idx][hInt]);
    INI_Int("World", HouseInfo[idx][hWorld]);
           
    printf("House %d loaded",idx);

    return 1;
}

forward CreateHouseLabelsPickups();
public CreateHouseLabelsPickups()
{
    new fstring[64];
    for(new idx = 1; idx < sizeof(HouseInfo); idx++)
    {
        format(fstring, 64, HOUSEPATH, idx);
        if(fexist(fstring))
        {
            if(HouseInfo[idx][hOwned] == 1)
            {
                HouseInfo[idx][hPickup] = CreateDynamicPickup(1239, 1, HouseInfo[idx][hEntrancex], HouseInfo[idx][hEntrancey], HouseInfo[idx][hEntrancez], 0);
                new labelstring[128];
                format(labelstring, sizeof(labelstring),"{F0C948}House owner: {FFFFFF}%s\n{F0C948}Level: {FFFFFF}%d",HouseInfo[idx][hOwner], HouseInfo[idx][hLevel]);
                HouseInfo[idx][sLabel] = CreateDynamic3DTextLabel(labelstring, 0xAAAAAAFF, HouseInfo[idx][hEntrancex], HouseInfo[idx][hEntrancey], HouseInfo[idx][hEntrancez], 10.0);
                        printf("House %d Pickup-And-Label Created! (OWNED)", idx);
            }

            else if(HouseInfo[idx][hOwned] == 0)
            {
                HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hEntrancex], HouseInfo[idx][hEntrancey], HouseInfo[idx][hEntrancez], 0);
                new labelstring2[128];
                format(labelstring2, sizeof(labelstring2),"{F0C948}House for sale!\nPrice: {FFFFFF}%d\n{F0C948}Level: {FFFFFF}%d",HouseInfo[idx][hPrice], HouseInfo[idx][hLevel]);
                HouseInfo[idx][sLabel] = CreateDynamic3DTextLabel(labelstring2, 0xAAAAAAFF, HouseInfo[idx][hEntrancex], HouseInfo[idx][hEntrancey], HouseInfo[idx][hEntrancez], 10.0);
                        printf("House %d Pickup-And-Label Created! (NON-OWNED)", idx);
            }
        }
    }
    KillTimer(house_timer);
}
Reply
#5

I Thought if it's INT value so put %i, gonna try this thanks for reply


EDIT: Thank you ALOT !!!!!!!!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)