SA-MP Forums Archive
3Dtextlabel as SA-MP nametag? - 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: 3Dtextlabel as SA-MP nametag? (/showthread.php?tid=635095)



3Dtextlabel as SA-MP nametag? - DemME - 01.06.2017

I'm trying to do something like RC-RP's like, it looks quite cool and I said why not grabbing the idea of my own.
That's basically when they're connected:

Quote:

GetPlayerName(playerid, PlayerInfo[playerid][pUsername], MAX_PLAYER_NAME);
format(PlayerInfo[playerid][pName], MAX_PLAYER_NAME, "%s", GiveNameSpaceEx(PlayerInfo[playerid][pUsername]));
NameTag[playerid] = Create3DTextLabel(PlayerInfo[playerid][pName], 0xFFFFFFFF, 0, 0, 0, NAME_DRAWDISTANCE, 0, 1 );
Attach3DTextLabelToPlayer(NameTag[playerid], playerid, 0.0, 0.0, 0.2);
GiveNameSpace(PlayerInfo[playerid][pName]);

Now basically, it's going under OnPlayerConnect, and I disabled the samp nametag, so there will be no armour or health bars, even though, I want to make it stock that I can grab or change it's colors everytime. like if I wanna call it in "/aduty" command and whenever admin on duty it will update the color of the textlabel, but I'm lost and I tried few ways and no success.


Re: 3Dtextlabel as SA-MP nametag? - JasonRiggs - 01.06.2017

Uhm, look, if you are trying to change the name color you should make the cmd then add under it "SetPlayerColor" and SetPlayerMarker to 0 so the nametag will be changed.


Re: 3Dtextlabel as SA-MP nametag? - DemME - 01.06.2017

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
Uhm, look, if you are trying to change the name color you should make the cmd then add under it "SetPlayerColor" and SetPlayerMarker to 0 so the nametag will be changed.
Does setplayercolor change the 3dtextlabel color? I mean, I dont need to change the color manually through the 3dtextlabel line variable?


Re: 3Dtextlabel as SA-MP nametag? - Logic_ - 01.06.2017

Use dynamic label..


Re: 3Dtextlabel as SA-MP nametag? - JasonRiggs - 01.06.2017

Quote:
Originally Posted by DemME
Посмотреть сообщение
Does setplayercolor change the 3dtextlabel color? I mean, I dont need to change the color manually through the 3dtextlabel line variable?
It changes his nametag color and puts for him a marker, that's why I'm telling u to turn the marker off after setting the player color, unless if you have the nametag as a 3dtextlabel which i totally don't support, but if you want it like that, you should make cases which changes the color like if (playerinfo[playerid][pAdminDuty]) = 1 and make that if the player is an on duty admin then set a color for that 3dtextlabel


Re: 3Dtextlabel as SA-MP nametag? - Beckett - 01.06.2017

I suggest you to use dynamic labels as instructed above, as you will face synchronization issues later on with this. I've had a similar experience.

However, I'll give you an example with Update3DTextLabelText.

Код:
Update3DTextLabelText(Nametag[playerid], 0xAA3333AA, GiveNameSpace(PlayerInfo[playerid][pName]);
This will update the 3D Text Label and color it to red. You can do the same when you wish to recolor it back to it's original color (white).

Remember to destroy the labels when the player disconnects, as it might override to players who connect with the same ID.


Re: 3Dtextlabel as SA-MP nametag? - DemME - 01.06.2017

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
I suggest you to use dynamic labels as instructed above, as you will face synchronization issues later on with this. I've had a similar experience.

However, I'll give you an example with Update3DTextLabelText.

Код:
Update3DTextLabelText(Nametag[playerid], 0xAA3333AA, GiveNameSpace(PlayerInfo[playerid][pName]);
This will update the 3D Text Label and color it to red. You can do the same when you wish to recolor it back to it's original color (white).

Remember to destroy the labels when the player disconnects, as it might override to players who connect with the same ID.
Yeah, I did the same. and thanks for notify me that sync problem, apprcieate.