[BUG]First textdraw/3dtext doesn't show
#1

I don't know why,
the first textdraw/3dtext label will never be shown.
I used a variable to store all of them.
Now I add 1 more useless textdraw/3dtext label to cover the problem.
Will that be solved?
Reply
#2

Remember that every time you create a Text: tagged variable, you should make its default value Text:INVALID_TEXT_DRAW, otherwise the default value will be 0. That means, that if you use TextDrawHideForPlayer/All, or TextDrawDestroy functions in any of these variables before assigning them a textdraw, the action will be applied to the textdraw with id 0, which is the first created textdraw.

This problem is very common, are you sure this isn't your case?
Reply
#3

Oh I don't know this :/
Solved, thanks for your help

BTW, I declare them as global variables and I've assigned each of them with a TextDrawCreate.
I still not be understand why it's still 0.
Still, thanks.
Reply
#4

Quote:
Originally Posted by leong124
Посмотреть сообщение
Oh I don't know this :/
Solved, thanks for your help

BTW, I declare them as global variables and I've assigned each of them with a TextDrawCreate.
I still not be understand why it's still 0.
Still, thanks.
Because in pawn all new variables start at 0 unless otherwise specified....on the other hand I don't know why in the world I never thought about this.....here I have had some odd textdraw bugs and the whole time its bugged id's.....go figure...I think this should def. make the wiki if it hasn't already.
Reply
#5

I know they initializes as 0,
but I've assigned a value for them in OnGameModeInit :/
Reply
#6

Quote:
Originally Posted by leong124
Посмотреть сообщение
I know they initializes as 0,
but I've assigned a value for them in OnGameModeInit :/
From the Wiki on TextDrawCreate:

Returns The ID of the created textdraw

So no matter what value you assign to the variable once the textdraw is created the variable holds the internal textdraw id that SAMP assigns it will not retain your own ID. By init'ing all the variables with INVALID_TEXT_DRAW simply means samp starts on the proper textdraw id.
Reply
#7

Okay now I understand more.
Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)