Nametags are overlapping. Need professional help.
#1

Okay so I got this problem with these custom nametags that I made, they don't work, sometimes they do and sometimes they don't, it's like another player's nametag gets placed on somebody elses nametag and then it shows it like this.



I have no idea what could be causing this, I'll show you the full code of the nametag system and you look at it, I really need help with this, it is messing my server.

pawn Код:
#define NAME_DRAWDISTANCE (5) // The distance of the 3d text nametags to appear.
new Text3D:NameTag[MAX_PLAYERS]; // The variable of the nametag.
// I put these two on the top of the script.

SetNameTagDrawDistance(0.0);
ShowNameTags(false);
// I put this under OnGameModeInit to hide the original nametags.

new playerName;
playerName = RemoveUnderScore(playerid);
NameTag[playerid] = Create3DTextLabel(playerName, 0xFFFFFFFF, 0, 0, 0, NAME_DRAWDISTANCE, 0, 1);
Attach3DTextLabelToPlayer(NameTag[playerid], playerid, 0.0, 0.0, 0.2);
// I put this OnPlayerConnect where the player officialy gets the nametag placed above his head.

Delete3DTextLabel(NameTag[playerid]);
// I put this under OnPlayerDisconnect to delete the nametag from his head because he disconnects.
I found this, pottus had commented on a thread similiar to my problem saying

Quote from Pottus: This is a pretty common issue when attaching 3d labels they bug out for some reason I would suggest using the streamer to handle 3d labels there is another thing you could try as well that is after you delete a label set it to INVALID_3DTEXT_ID then before creating make sure that the variable is INVALID_3DTEXT_ID if not delete it.

I didn't understand anything so I hope you can.
Reply
#2

If you use streamer plugin, just use this instead:
PHP код:
native Text3D:CreateDynamic3DTextLabel(const text[], colorFloat:xFloat:yFloat:zFloat:drawdistanceattachedplayer INVALID_PLAYER_IDattachedvehicle INVALID_VEHICLE_IDtestlos 0worldid = -1interiorid = -1playerid = -1Float:streamdistance 100.0); 
Reply
#3

It dosen't even show if I use that.
Reply
#4

Quote:
Originally Posted by Turn
Посмотреть сообщение
It dosen't even show if I use that.
Make sure you have streamer plugin and that you're using it right....
PHP код:
CreateDynamic3DTextLabel(nickWHITE0.00.00.010.0playeridINVALID_VEHICLE_ID0, -1, -1, -110.0); 
That way you'll attach the label to the head of playerid and show it to all players with a draw distance of 10.0.
Reply
#5

Now it shows but the problem remains, there is two nametags in one.
Reply
#6

Quote:
Originally Posted by Turn
Посмотреть сообщение
Now it shows but the problem remains, there is two nametags in one.
Forgot to mention that you would have to delete it with DestroyDynamic3DTextLabel, are you already doing that?
If you're not messing with those apart from onconnect and disconnect your code seems to be right.
Reply
#7

If i am not wrong, the var playerName is an integer but it must be a string playerName[MAX_PLAYER_NAME].

And dynamic streamer dont use a custom 3dtext streamer, its completly dependent on CreatePlayer3DTextLabel.
Reply
#8

ginger is right, change playerName to playerName[MAX_PLAYER_NAME]
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)