SA-MP Forums Archive
Names with 3D Text Labels change?! - 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: Names with 3D Text Labels change?! (/showthread.php?tid=529837)



Names with 3D Text Labels change?! - alanhutch - 04.08.2014

Hi all...

I'm wondering why sometimes the names made with 3D Text Label, sometimes overlap and change...
Example:

Player1 has Player2 name, but Player2 has Player1 name overlapped to his name.

Here's the code.
pawn Код:
//On top
#define NAME_DRAWDISTANCE (5)
new Text3D:NameTag[MAX_PLAYERS];
//OnPlayerDisconnect
Delete3DTextLabel( NameTag[playerid] );
//OnPlayerConnect
playerName = p_name( playerid );
    NameTag[playerid] = Create3DTextLabel(playerName, 0xFFFFFFFF, 0, 0, 0, NAME_DRAWDISTANCE, 0, 1 );
    Attach3DTextLabelToPlayer(NameTag[playerid], playerid, 0.0, 0.0, 0.2);
//OnGameModeInit
 SetNameTagDrawDistance(0.0);
    ShowNameTags(false);
Thanks.


Re: Names with 3D Text Labels change?! - ronyx69 - 04.08.2014

Only thing I could think of is that your p_name function returns the wrong name. Use:

pawn Код:
GetPlayerName(playerid, playerName, sizeof(playerName));

Also it could be that you would be better off using a different name variable for each person, so an array:

pawn Код:
new playerName[MAX_PLAYERS][24];
GetPlayerName(playerid, playerName[playerid], sizeof(playerName[playerid]));



Re: Names with 3D Text Labels change?! - alanhutch - 04.08.2014

Thanks, it resolved that. REP+