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

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
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);
Well you're right they are floats, but I generally check them to be over 0... 0.000000 still would if rounded off equal zero. I have thought this was the issue but. All this does is checks it the business has an interior, and if it does. The name of the business on the 3DTextLabel is green, and if it doesn't. The name is red.

All business' work the way they are meant to in game, even though the interior check is equal to zero as opposed to 0.00000. The labels show in the correct format with the correct colors, except this one business. Which has an interior but it fails to show it. HOWEVER. As I was typing this, I just realized it only prints it if the coordinates are OVER 0.
The coordinates for that interior are in the negatives, making that the issue! You know! After this extensive trial and error. Without even testing it.. I think that is why it's having this issue.

It only shows a label for interiors with coordinates that are positive. Changing those to > 0 || < 0. Probably would be the best bet.. or > 0.0000000 || < 0.00000000 to be on the safe side.

Thank You! You're being repped! Appreciate the help, man!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)