SA-MP Forums Archive
Dynamic 3D Texts not appearing - 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)
+--- Thread: Dynamic 3D Texts not appearing (/showthread.php?tid=616478)



Dynamic 3D Texts not appearing - Amads - 05.09.2016

Hello.
I have a problem - after some time (30-60+ minutes?) some dynamic 3d text labels are simply not appearing for whatever reason. They work fine in the first minutes after launching a server but after some time they are nowhere to be seen. Here's the code:

PHP код:
new Text3D:Info3DText[MAX_PLAYERS]; // top of the gamemode
if(IsValidDynamic3DTextLabel(Info3DText[playerid])) DestroyDynamic3DTextLabel(Info3DText[playerid]); // OnPlayerConnnect
Info3DText[playerid] = CreateDynamic3DTextLabel(strInfoText0xFF9900BB0.00.00.4510playeridINVALID_VEHICLE_ID1); // OnPlayerConnnect
if(IsValidDynamic3DTextLabel(Info3DText[playerid])) DestroyDynamic3DTextLabel(Info3DText[playerid]); // OnPlayerDisconnect 
The string is not the problem.


Re: Dynamic 3D Texts not appearing - Threshold - 05.09.2016

The issue here is that you never reset the value of 'Info3DText[playerid]'. Just because you use it in DestroyDynamic3DTextLabel, doesn't mean the value changes.

Example:
PHP код:
// OnPlayerDisconnect
if(IsValidDynamic3DTextLabel(Info3DText[playerid]))
{
    
DestroyDynamic3DTextLabel(Info3DText[playerid]);
    
Info3DText[playerid] = -1;

So when the next player connects, 'Info3DText[playerid]' will still be a valid 3d label ID. So it will end up destroying someone else's text label.


Re: Dynamic 3D Texts not appearing - Amads - 05.09.2016

It spews out 'tag mismatch' warnings now, should I just ignore it?


Re: Dynamic 3D Texts not appearing - Threshold - 06.09.2016

Sorry, my bad. I make a lot of mistakes on my phone for some reason.

PHP код:
Info3DText[playerid] = Text3D:-1