Loading Houses
#1

So i've got a problem with loading houses, there is 3 houses in Database but server only loads the one with ID 1, i mean it creates the pickup for the house id 1, other houses are not loaded and pickup and labels are not created.

pawn Код:
case THREAD_UCITAJKUCE:
        {
            if(szRows)
            {
                new temp[130];
                for(new i = 0; i < szRows; i++)
                {
                    cache_get_field_content(0, "ID",  temp);
                    HInfo[i][kID] = strval(temp);
                   
                    cache_get_field_content(0, "ImaVlasnika", temp);
                    HInfo[i][ImaVlasnika] = strval(temp);
                   
                    cache_get_field_content(0, "Vlasnik", temp);
                    format(HInfo[i][Vlasnik], 50, "%s", temp);
                   
                    cache_get_field_content(0, "Vrsta", temp);
                    format(HInfo[i][Vrsta], 50, "%s", temp);
                   
                    cache_get_field_content(0, "Adresa", temp);
                    format(HInfo[i][Adresa], 32, "%s", temp);
                   
                    cache_get_field_content(0, "UlazX", temp);
                    HInfo[i][UlazX] = floatstr(temp);
                   
                    cache_get_field_content(0, "UlazY", temp);
                    HInfo[i][UlazY] = floatstr(temp);
                   
                    cache_get_field_content(0, "UlazZ", temp);
                    HInfo[i][UlazZ] = floatstr(temp);

                    cache_get_field_content(0, "UlazA", temp);
                    HInfo[i][UlazA] = floatstr(temp);
                   
                    cache_get_field_content(0, "IzlazX", temp);
                    HInfo[i][IzlazX] = floatstr(temp);
                   
                    cache_get_field_content(0, "IzlazY", temp);
                    HInfo[i][IzlazY] = floatstr(temp);
                   
                    cache_get_field_content(0, "IzlazZ", temp);
                    HInfo[i][IzlazZ] = floatstr(temp);
                   
                    cache_get_field_content(0, "IzlazA", temp);
                    HInfo[i][IzlazA] = floatstr(temp);
                   
                    cache_get_field_content(0, "DostupanRent", temp);
                    HInfo[i][DostupanRent] = strval(temp);
                   
                    cache_get_field_content(0, "RentCena", temp);
                    HInfo[i][RentCena] = strval(temp);

                    cache_get_field_content(0, "Droga", temp);
                    HInfo[i][Droga] = strval(temp);

                    cache_get_field_content(0, "Mats", temp);
                    HInfo[i][Mats] = strval(temp);

                    cache_get_field_content(0, "Zakljucano", temp);
                    HInfo[i][Zakljucano] = strval(temp);

                    cache_get_field_content(0, "Cena", temp);
                    HInfo[i][Cena] = strval(temp);

                    cache_get_field_content(0, "VW", temp);
                    HInfo[i][VW] = strval(temp);

                    cache_get_field_content(0, "Interior", temp);
                    HInfo[i][Interior] = strval(temp);

                    cache_get_field_content(0, "kLevel", temp);
                    HInfo[i][Level] = strval(temp);

                    cache_get_field_content(0, "Novac", temp);
                    HInfo[i][Novac] = strval(temp);

                    SpawnedHouses++;
                   
                    PostaviKucneLabele(i);
                }
            }
        }

pawn Код:
stock PostaviKucneLabele(hID)
{
    new str[500];
    switch(HInfo[hID][ImaVlasnika])
    {
        case 0:
        {
            Delete3DTextLabel(KucaLabel[hID]);
            format(str, sizeof(str), "{F3FF02}Kuca na prodaju\n{FFFFFF}Vrsta: {0049FF}%s\n{FFFFFF}Cena: {0049FF}$%d\n{FFFFFF}Level: {0049FF}%d\n{FFFFFF}Adresa: {0049FF}%s", HInfo[hID][Vrsta], HInfo[hID][Cena], HInfo[hID][Level], HInfo[hID][Adresa]);
            KucaLabel[hID] = Create3DTextLabel(str ,0x00FF00AA, HInfo[hID][UlazX], HInfo[hID][UlazY], HInfo[hID][UlazZ], 10, 0, 1);
        }
        case 1:
        {
            if(HInfo[hID][DostupanRent] == 0)
            {
                Delete3DTextLabel(KucaLabel[hID]);
                format(str, sizeof(str), "{FFFFFF}Vlasnik Kuce: {0049FF}%s\n{FFFFFF}Vrsta: {0049FF}%s\n{FFFFFF}Level: {0049FF}%d\n{FFFFFF}Adresa: {0049FF}%s", HInfo[hID][Vlasnik], HInfo[hID][Vrsta], HInfo[hID][Level], HInfo[hID][Adresa]);
                KucaLabel[hID] = Create3DTextLabel(str ,0xFFFFFFAA, HInfo[hID][UlazX], HInfo[hID][UlazY], HInfo[hID][UlazZ], 10, 0, 1);
            }
            else if(HInfo[hID][DostupanRent] == 1)
            {
                Delete3DTextLabel(KucaLabel[hID]);
                format(str, sizeof(str), "{FFFFFF}Vlasnik Kuce: {0049FF}%s\n{FFFFFF}Vrsta: {0049FF}%s\n{FFFFFF}Level: {0049FF}%d\n{FFFFFF}Cena Renta: {0049FF}$%d\n{FFFFFF}Adresa: {0049FF}%s", HInfo[hID][Vlasnik], HInfo[hID][Vrsta], HInfo[hID][Level], HInfo[hID][RentCena], HInfo[hID][Adresa]);
                KucaLabel[hID] = Create3DTextLabel(str ,0xFFFFFFAA, HInfo[hID][UlazX], HInfo[hID][UlazY], HInfo[hID][UlazZ], 10, 0, 1);
            }
        }
    }
    KucaPickup[hID] = CreatePickup(1273, 1, HInfo[hID][UlazX], HInfo[hID][UlazY], HInfo[hID][UlazZ]);
    return 1;
}
Reply
#2

Now i managed to load pickups but labels are not showing.

I changed

cache_get_field_content(0, ...

to

cache_get_field_content(i, ...
Reply
#3

Anyone, still can't manage it to load labels correctly.
Reply
#4

It loads houses perfectly, pickups and info, but labels are problem, it loads only label for 1 house other houses don't have labels.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)