Housing Script
#5

Quote:
Originally Posted by Mionee
Посмотреть сообщение
You use a loop to loop through all existing files.

This is my LoadHouses(); stock:

pawn Код:
stock LoadHouses()
{
    new hlabel[128], file[64], s[64];

    for(new i = 0; i < 50; i++) Delete3DTextLabel(Text3D: i);

    for(new h = 0; h < MAX_HOUSES; h++)
    {
        format(file, 64, "Houses/%d.ini", h);

        if(fexist(file))
        {
            INI_ParseFile(HousePath(h), "LoadHouseData", false, true, h, true, false );

            format(hlabel, 128, "[HOUSE]\n{46E850}[Owner]{FFFFFF}: %s\n{46E850}[Price]{FFFFFF}: %d", hInfo[h][Owner], hInfo[h][Price]);
            Create3DTextLabel(hlabel, 0xFFFFFF, hInfo[h][extX], hInfo[h][extY], hInfo[h][extZ], 15.0, 0, 1);

            format(s, 64, "  [!!] Loaded house ID: %d at %f %f %f", h, hInfo[h][extX], hInfo[h][extY], hInfo[h][extZ]);
            printf(s);
        }
    }
}
pawn Код:
forward LoadHouseData(h, name[], value[]);
public LoadHouseData(h, name[], value[])
{
    INI_String("Owner", hInfo[h][Owner], 32);
    INI_Int("Price", hInfo[h][Price]);
    INI_Int("Bought", hInfo[h][Bought]);

    INI_Float("extX", hInfo[h][extX]);
    INI_Float("extY", hInfo[h][extY]);
    INI_Float("extZ", hInfo[h][extZ]);

    INI_Float("intX", hInfo[h][intX]);
    INI_Float("intY", hInfo[h][intY]);
    INI_Float("intZ", hInfo[h][intZ]);

    INI_Int("intVW", hInfo[h][intVW]);
    INI_Int("intW", hInfo[h][intW]);
    INI_Int("Locked", hInfo[h][Locked]);

    return 1;
}
Is there a limit to how many houses that can be stored this way?
Reply


Messages In This Thread
Housing Script - by Nathan_Taylor - 03.05.2014, 03:14
Re: Housing Script - by Dignity - 03.05.2014, 03:19
Re: Housing Script - by Nathan_Taylor - 03.05.2014, 03:21
Re: Housing Script - by Dignity - 03.05.2014, 03:24
Re: Housing Script - by Nathan_Taylor - 03.05.2014, 03:27
Re: Housing Script - by Dignity - 03.05.2014, 03:29

Forum Jump:


Users browsing this thread: 2 Guest(s)