3DTextLabel Text Wrap
#1

There is a way to warp in other line the text of a 3DTextLabel when it see a certain character?
Example when it found pipe | the other text is on a lower line.

so when I do /label text1 | text2
There will be a 3DTextLabel that looks like
text1
text2

Sorry for my bad english.
Reply
#2

Using \n will place the text on a new line.
Reply
#3

something like
for(new i = 0; i<sizeof(string);i++)
{
if(string[i] = '|')
{
string[i] = "\n";
}
}
??
Reply
#4

I've done this:
Код:
enum plabel
{
	Created = 0,
	Text:pttext,
};
new LabelInfo[MAX_PLAYERS][plabel][5];
			for(new j=0; j<5; j++)
			{
				if(LabelInfo[playerid][Creato][j] == 0)
				{
				    LabelInfo[playerid][Creato][j] = 1;
				    LabelInfo[playerid][pttext][j] = Create3DTextLabel(stringaa, 0xFFFFFFFF, pX,pY,pZ, 15.0, pvw, 1);
				    return 1;
				}
			}
			return 1;
	}
and give me these errors:

(27810) : error 006: must be assigned to an array
(27819) : error 001: expected token: ")", but found "["
(27819) : error 029: invalid expression, assumed zero
(27819) : warning 215: expression has no effect
(27819) : error 001: expected token: ";", but found "]"
(27819) : fatal error 107: too many error messages on one line

Can anyone help?
Reply
#5

Use this, instead of your loop:
Код:
for(new i=0, m=strlen(result);i < m; i++)
{
	if(result[i] == '|')
	{
		result[i] = '\n';
	}
}
This should work. The compiler recognizes '\n' as one character.
Reply
#6

Ok, I've fixed the enum to
new LabelInfo[MAX_PLAYERS][plabel][5]; I've forgotten to put plabel xD and the if errors are fixed
and with your code it doesn't give error thanks!
But last thing, it give a tag mismatch warning for this line:
Код:
LabelInfo[playerid][pttext][j] = Create3DTextLabel(stringaa, 0xFFFFFFFF, pX,pY,pZ, 15.0, pvw, 1);
Reply
#7

Make sure the tags are correct. So LabelInfo[playerid][pttext][j] needs to have a "Text:"-tag. stringaa needs to be an array/string. pX, pY and pZ require a "Float:"-tag etc.
Reply
#8

I've uptaded the code above,
stringaa :
Код:
new stringaa[256];
format(stringaa, sizeof(stringaa),"%s",result);
on enum pttext is
Код:
Text:pttext;
and X,Y,Z are
Код:
Float:X, Float:Y, Float:Z;
oh, and I've done +REP for your help

EDIT:
I've fixed the warning with declaring pttext as Text3D:
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)