SA-MP Forums Archive
[BUG]First textdraw/3dtext doesn't show - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [BUG]First textdraw/3dtext doesn't show (/showthread.php?tid=200371)



[SOLVED]First textdraw/3dtext doesn't show - leong124 - 18.12.2010

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?


Re: [BUG]First textdraw/3dtext doesn't show - Zamaroht - 18.12.2010

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?


Re: [BUG]First textdraw/3dtext doesn't show - leong124 - 18.12.2010

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.


Re: [BUG]First textdraw/3dtext doesn't show - cyber_punk - 18.12.2010

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.


Re: [BUG]First textdraw/3dtext doesn't show - leong124 - 18.12.2010

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


Re: [BUG]First textdraw/3dtext doesn't show - cyber_punk - 18.12.2010

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.


Re: [BUG]First textdraw/3dtext doesn't show - leong124 - 18.12.2010

Okay now I understand more.
Thanks