[3dTextLabels] Using a string
#1

Hi sa-mp,

Appearently whenever I use a string in a 3DTextLabel, it's simply not showing up.
Does anyone know a reason why it isn't working?

Here a bit of the code (simply all of it ):
pawn Код:
new name[128];
pawn Код:
if(HouseInfo[houseid][hSellable] == 1){
            HouseInfo[houseid][hPickup] = CreatePickup(1273, 23, HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]); // not bought
            HouseInfo[houseid][hText] = Create3DTextLabel("House for sale",COLOR_GREEN,HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]+2,40.0,0);
        } else {
            HouseInfo[houseid][hPickup] = CreatePickup(1272,23, HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]); // bought
            format(name,sizeof(name),"%s's House",HouseInfo[houseid][hName]);
            HouseInfo[houseid][hText] = Create3DTextLabel(name,0x8D8DFF00,HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]+2,40.0,0);
        }
The 'House for sale' label is working on every house non-bought.
The other label is not working on any house.

Screenshots:



Thank you for helping me fixing this in advance,

KnooL
Reply
#2

is the variable "name" too small?
Reply
#3

Have you tried whitout "name" variable like,

Quote:

HouseInfo[houseid][hText] = Create3DTextLabel("Bought House",0x8D8DFF00,HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]+2,40.0,0);

Does it work if you make it like that?

I know you need to use "name" but how about try that and then tell does it work
And ofc you need delete & make new textlabel when someone buy or sell that house.
Reply
#4

Loop all of the houses then use JoFi's code expect replace houseid with i. Make sure the string is big enough.
Reply
#5

Quote:
Originally Posted by » JoFi »
Have you tried whitout "name" variable like,

Quote:

HouseInfo[houseid][hText] = Create3DTextLabel("Bought House",0x8D8DFF00,HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]+2,40.0,0);

Does it work if you make it like that?

I know you need to use "name" but how about try that and then tell does it work
And ofc you need delete & make new textlabel when someone buy or sell that house.
Ofcourse I have set to update the label when bought or sold.

Without the formatted string it works without a bug.

Quote:
Originally Posted by jonrb
is the variable "name" too small?
Код:
MAX_PLAYER_NAME = 24 
STRING = 9
MAX_PLAYER_NAME + STRING = 33
Formatted string (name) = 128

Quote:
Originally Posted by NiiRV4N4
Loop all of the houses then use JoFi's code expect replace houseid with i. Make sure the string is big enough.
The loop is using the variable houseid, no need to change that. Also JoFi's reply contains a non-formatted string which resolves the problem, but not the way I want it to have.
Reply
#6

What you have in "new 3DText:"
Reply
#7

pawn Код:
new PlayerText3D: SpeedText[MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)