PDA

View Full Version : Labels on the Head Part 2


JaKe Elite
26/03/2015, 11:43 AM
The labels are now working perfectly fine, but this time the disappearing label passes on players.
For example, ID 0 doesn't have a label on his head, once he time out and relogs this problem will pass on ID 1 and so on.

I am not sure, I have tried someone's suggestion with the INVALID_3DTEXT_LABEL thing.
It is almost working except to this problem.

Here is my code.


new Text3D:Label[MAX_PLAYERS];

//OnGameModeInit
for(new x=0; x<MAX_PLAYERS; x++)
{
Label[x] = Text3D:INVALID_3DTEXT_ID;
}

//OnPlayerConnect
Label[playerid] = Create3DTextLabel("SWF", -1, 0.0, 0.0, 0.0, 7.0, 0);
Attach3DTextLabelToPlayer(Label[playerid], playerid, 0.0, 0.0, 0.5);

//OnPlayerDisconnect

Delete3DTextLabel(Label[playerid]);
Label[playerid] = Text3D:INVALID_3DTEXT_ID;

//Other functions

Update3DTextLabelText(bahblah) - But i don't think this has something to do with it so yeah leave it like that

JaKe Elite
26/03/2015, 04:11 PM
Bump...

CalvinC
26/03/2015, 04:13 PM
Bumping a topic in which you have or require further information is allowed after at least 24 hours.
But i would suggest using a streamer with dynamic text labels.

Dutheil
26/03/2015, 04:49 PM
You can declare your array like that.
new
Text3D:Label[MAX_PLAYERS] = {Text3D:INVALID_3DTEXT_ID, ...};


That way you don't have to use a loop in OnGameModeInit

Pottus
26/03/2015, 05:10 PM
Do not use standard labels they bug out when attaching to the player happens every time! Use the streamer plugin and dynamic labels and you shouldn't have the same issues.

JaKe Elite
26/03/2015, 07:02 PM
well how am i gonna do that with streamer do i have to usr var for ipdating the labels?

Pottus
26/03/2015, 09:05 PM
They work almost the same way.

CalvinC
26/03/2015, 09:09 PM
well how am i gonna do that with streamer do i have to usr var for ipdating the labels?

Pretty much the same, just different names of the functions, but you can check them out on the topic:
http://forum.sa-mp.com/showthread.php?t=102865
There's a list of all the functions, just use CTRL+F to search for the one you want, like "CreateDynamic", and you can easily find CreateDynamic3DTextLabel and it's parameters.