SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/07/2018, 06:10 PM   #1
Janoz12
Little Clucker
 
Join Date: Aug 2016
Posts: 13
Reputation: 0
Default NameTag using Create3DTextLabel for TDM

I am creating a system to replace the original NameTag identification with one of the server using Create3DTextLabel, my server is Team Deathmatch and I require that the names of each player created with Create3DTextLabel only be shown for the players of the same team but for the players of the opposing team "eliminate".

I am using OnPlayerStreamIn to achieve this but still it does not seem to work in any way.

HTML Code:
#define NAME_DRAWDISTANCE (5)
new Text3D:NameTag[MAX_PLAYERS];
new NameTagX[MAX_PLAYER_NAME + 1];
new ColorTag[MAX_PLAYERS];

if(gTeam[playerid] == gTeam[forplayerid])
{
GetPlayerName(playerid, NameTagX, sizeof(NameTagX));
ColorTag[playerid] = GetPlayerColor(playerid);
NameTag[playerid] = Create3DTextLabel(NameTagX, ColorTag[playerid], 0, 0, 0, NAME_DRAWDISTANCE, 0, 1);
Attach3DTextLabelToPlayer(NombreTag[playerid], playerid, 0.0, 0.0, 0.3);
}
else
{
Delete3DTextLabel(NombreTag[forplayerid]);
}
Edited: Forget to point out "problems" or "errors" xD

I give an easy example (I think)

Team A and team B

3 players in team A enter and can see their names created with the Create3DTextLabel, until then it seems to work.

Suppose 1 player leaves team A and enters team B, then goes to the position of the 2 players left in A, for some reason he can see the names of A and B.
Janoz12 is offline   Reply With Quote
Old 11/07/2018, 06:27 PM   #2
diego200052
Big Clucker
 
Join Date: Jul 2013
Location: Mйxico
Posts: 56
Reputation: 2
Default Re: NameTag using Create3DTextLabel for TDM

This code:

Code:
if(gTeam[playerid] == gTeam[forplayerid])
{
GetPlayerName(playerid, NameTagX, sizeof(NameTagX));
ColorTag[playerid] = GetPlayerColor(playerid);
NameTag[playerid] = Create3DTextLabel(NameTagX, ColorTag[playerid], 0, 0, 0, NAME_DRAWDISTANCE, 0, 1);
Attach3DTextLabelToPlayer(NombreTag[playerid], playerid, 0.0, 0.0, 0.3);
}
else
{
Delete3DTextLabel(NombreTag[forplayerid]);
}

Is on the callback OnPlayerStreamIn?
diego200052 is offline   Reply With Quote
Old 11/07/2018, 07:15 PM   #3
Janoz12
Little Clucker
 
Join Date: Aug 2016
Posts: 13
Reputation: 0
Default Re: NameTag using Create3DTextLabel for TDM

Yes, it is located there.
Janoz12 is offline   Reply With Quote
Old 11/07/2018, 07:24 PM   #4
Sew_Sumi
Godfather
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,296
Reputation: 519
Default Re: NameTag using Create3DTextLabel for TDM

Are you using the streamer at all elsewhere? As that'd be your better option if you're using that.

And where did you get the idea of using OnPlayerStreamIn for this? I don't think this is a wise decision.
Sew_Sumi is offline   Reply With Quote
Old 11/07/2018, 11:11 PM   #5
Janoz12
Little Clucker
 
Join Date: Aug 2016
Posts: 13
Reputation: 0
Default Re: NameTag using Create3DTextLabel for TDM

And what do you suggest?

I use OnPlayerStreamIn because I had used it before for a similar function but I use the NameTag that comes by default but now I want to manage that NameTag server side to avoid traps.
Janoz12 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nametag Johny32 Scripting Help 0 01/07/2016 01:41 PM
[Include] [INC] NameTag Fro1sha Релизы/Releases 2 06/05/2010 06:51 AM
NameTag FreeSoul Help Archive 1 28/05/2009 06:42 AM


All times are GMT. The time now is 06:45 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.