Create3DTextLabel ??
#1

So i want to create a Create3DTextLabel with a dialog.
so i do
pawn Код:
new textString3D[98];
format(textString3D,sizeof(textString3D),"%s",inputtext);
TextNo = Create3DTextLabel(textString3D,COLOR_WHITE,X,Y,Z,50.0,0,0);
TextNo++;
and the when i want to remove it(this is the problem)
pawn Код:
TextNo = strval(inputtext);//But that would make it (warning 213: tag mismatch)
Delete3DTextLabel(TextNo);
TextNo--;
Reply
#2

You don't need TextNo++; and TextNo--;

You create the label with TextNo. Then you increase TextNo by one. So theres no label to delete.

What are you trying to do here ? > > TextNo = strval(inputtext);

To delete it, Delete3DTextLabel(TextNo); is enough :S

Unless your trying to do something wierd.
Reply
#3

Hi.

At TOP of your script you have to declare the 3DTextVariable, let's call it, DialogLabel. And because you want to create more then one, we delare the number you want to have as well. Let's put it to 100, but you can change it.
pawn Код:
#define MAX_LABELS_I_USE_AT_MY_DIALOG 100
new Text3D:DialogLabels[MAX_LABELS_I_USE_AT_MY_DIALOG];
We also need a vraible to store if the ID was already used:
pawn Код:
new Used3DTextAtDialog[MAX_LABELS_I_USE_AT_MY_DIALOG];
Now at the OnDialogResponse:
pawn Код:
new textString3D[98], ID=-1;
format(textString3D,sizeof(textString3D),"%s",inputtext);
for(new i=0; i<MAX_LABELS_I_USE_AT_MY_DIALOG; i++) if(Used3DTextAtDialog[i]==0) ID=i, break;
if(ID==-1) return SendClientMessage(playerid, COLOR_RED, "ERROR: All Dialog-3DTexts are used!"); //If this comes, change 'MAX_LABELS_I_USE_AT_MY_DIALOG' to a higher value.
DialogLabels[ID] = Create3DTextLabel(textString3D,COLOR_WHITE,X,Y,Z,50.0,0,0);
Used3DTextAtDialog[ID]=1; //This will let the server know, that this dialog-3dtext is now in use.
And this is where you remove it (Here we need the ID from upon):
pawn Код:
Remove = strval(inputtext);
Delete3DTextLabel(DialogLabels[Remove]);
Used3DTextAtDialog[Remove]=0;  //This will let the server know, that this dialog-3dtext is not used anymore.
I hope this helps you.

If you have any questions, feel free to ask.


Jeffry
Reply
#4

soz i cant explaint it
ok so i go this dialog that creates the 3DText
and it works fine
And the i got a dialog that removes the 3DText
Lets say you create [3] 3DText's and then you want to remove them!!!

So you would have to type a ID in the dialog box to remove it.
Reply
#5

Check my post mister.
That will help you.
Reply
#6

OK first THANKS ALOT JEFFRY
and second i get a ERROR
Код:
error 029: invalid expression, assumed zero
ERROR IN LINE
pawn Код:
if(Used3DTextAtDialog[i]==0) ID=i, break;
dont worry fix it got ride of the [,break] it works fine HUGE THANKS
Reply
#7

Nice, but you have to use the break, else there will be bugs.

Change:
pawn Код:
for(new i=0; i<MAX_LABELS_I_USE_AT_MY_DIALOG; i++) if(Used3DTextAtDialog[i]==0) ID=i, break;
to:
pawn Код:
for(new i=0; i<MAX_LABELS_I_USE_AT_MY_DIALOG; i++)
{
    if(Used3DTextAtDialog[i]==0)
    {
        ID=i;
        break;
    }
}

Jeffry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)