One 3D Text Label in particular is NOT loading
#7

Your checks to create the textlabels seem a bit odd.
pawn Код:
if(BusInfo[i][Owned] == 0)
        {
            if((BusInfo[i][iX] > 0) && (BusInfo[i][iZ] > 0) && (BusInfo[i][iZ] > 0))
            {
                format(labeltext, sizeof(labeltext), "{00FF33}%s\n{FFFFFF}Price: {33FF00}${FFFFFF}%d\n{00FF33}For Sale!", BusInfo[i][BusName], BusInfo[i][Price]);
            }
            else if((BusInfo[i][iX] == 0) && (BusInfo[i][iZ] == 0) && (BusInfo[i][iZ] == 0))
            {
                format(labeltext, sizeof(labeltext), "{FF0000}%s\n{FFFFFF}Price: {33FF00}${FFFFFF}%d\n{00FF33}For Sale!", BusInfo[i][BusName], BusInfo[i][Price]);
            }
        }
        else
        {
            if((BusInfo[i][iX] > 0) && (BusInfo[i][iZ] > 0) && (BusInfo[i][iZ] > 0))
            {
                format(labeltext, sizeof(labeltext), "{00FF33}%s\n{FFFFFF}Owned By: %s", BusInfo[i][BusName], BusInfo[i][Owner]);
            }
            else if((BusInfo[i][iX] == 0) && (BusInfo[i][iZ] == 0) && (BusInfo[i][iZ] == 0))
            {
                format(labeltext, sizeof(labeltext), "{FF0000}%s\n{FFFFFF}Owned By: %s", BusInfo[i][BusName], BusInfo[i][Owner]);
            }
        }
The values iX, iY, iZ are floats (you load them with "cache_get_row_float"), but you check them as if they were integers.
Even if you set them to 0, there is a chance due to binary limitations to represent floats accurately that those values won't be exactly 0.0000000000000...
It could be -0.0000000000000000000001 and your code to create the textlabels won't work, as you only check if it's higher than 0, or exactly equal to 0.
For any negative value (how small it may be), your textlabel won't be created and your textlabel won't show up as the labeltext is empty.

You can try to use printf to print those values to the server console to see if there is any value negative.
You can also print the labeltext to see if there is any business without a labeltext (which would explain why you don't see the label).
pawn Код:
BusInfo[i][iX] = cache_get_row_float(i, 8);
        BusInfo[i][iY] = cache_get_row_float(i, 9);
        BusInfo[i][iZ] = cache_get_row_float(i, 10);
        printf("BusInfo[%i][iX] = %f", i, BusInfo[i][iX]);
        printf("BusInfo[%i][iY] = %f", i, BusInfo[i][iY]);
        printf("BusInfo[%i][iZ] = %f", i, BusInfo[i][iZ]);

        // Other code

        printf("LabelText: %s", labeltext);
        BusLabel[i] = CreateDynamic3DTextLabel(labeltext, COLOR_SNOW, BusInfo[i][CPX], BusInfo[i][CPY], BusInfo[i][CPZ], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
        BizzEnter[i] = CreateDynamicPickup(1272, 23, BusInfo[i][CPX], BusInfo[i][CPY], BusInfo[i][CPZ], -1, -1, -1, 100.0);
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)