Dynamic 3d text labels - issues destroying properly -
denNorske - 11.03.2015
Hello.
Im using Incognitos streamer plugin (latest version) and i have a code to "mark" players as away when they are paused (when onplayerupdate isn't called)
However, when onplayerupdate is called, i attempt to destroy the textlabel. In the code below, i include two examples i've used, and what it causes online.
PHP код:
new afkvar[MAX_PLAYERS];
new Text3D:afk[MAX_PLAYERS];
//onplayerupdate2 called every second
if(IsPlayerAfk(i) && GetPVarInt(i, "notspawned") == 0)
{
if(afkvar[i] == 0)
{
afk[i] = CreateDynamic3DTextLabel("Away / AFK", 0xEE0000AA, 0.0, 0.0, 1.3, 40.0, i, INVALID_VEHICLE_ID, 1, -1,-1, -1, 300.0);
afkvar[i] = 1;
}
}
//onplayerupdate:
afkvar[playerid] = 0;
if(IsValidDynamic3DTextLabel(afk[playerid]))
DestroyDynamic3DTextLabel(afk[playerid]);
//no afk tags appear wit this, i think it also affects other labels? I mean, private car labels wont even show now.
//i also tried this on onplayerupdate://
if(afkvar[playerid])
{
//remove the text and set afkvar[playerid] = 0;
}
//but text wont dissapear at all times here. So many players have the tag above their heads.
Is there any ideas what i can do / try ?
Any help would be greatly appreciated.
Re: Dynamic 3d text labels - issues destroying properly -
Dragonsaurus - 11.03.2015
Have you tried setting a blank text (space: " ") instead? This way you won't even have to re-create it all over again, when OnPlayerUpdate ain't getting called.
Edit: Been a long time...hello
Re: Dynamic 3d text labels - issues destroying properly -
denNorske - 11.03.2015
Quote:
Originally Posted by Dragonsaurus
Have you tried setting a blank text (space: " ") instead? This way you won't even have to re-create it all over again, when OnPlayerUpdate ain't getting called.
Edit: Been a long time...hello
|
That sounds indeed as a very nice idea
I also know that the native function to destroy text labels has some kind of a bug, and it wont work properly.
Nice idea.
Re: Dynamic 3d text labels - issues destroying properly -
paul988 - 11.03.2015
I think this should work, not sure though:
pawn Код:
if(IsPlayerAfk(i) && GetPVarInt(i, "notspawned") == 0)
{
if(afkvar[i] == 0 && !IsValidDynamic3DTextLabel(afk[i]) )
{
afk[i] = CreateDynamic3DTextLabel("Away / AFK", 0xEE0000AA, 0.0, 0.0, 1.3, 40.0, i, INVALID_VEHICLE_ID, 1, -1,-1, -1, 300.0);
afkvar[i] = 1;
}
}
Re: Dynamic 3d text labels - issues destroying properly -
denNorske - 11.03.2015
Quote:
Originally Posted by paul988
I think this should work, not sure though:
pawn Код:
if(IsPlayerAfk(i) && GetPVarInt(i, "notspawned") == 0) { if(afkvar[i] == 0 && !IsValidDynamic3DTextLabel(afk[i]) ) { afk[i] = CreateDynamic3DTextLabel("Away / AFK", 0xEE0000AA, 0.0, 0.0, 1.3, 40.0, i, INVALID_VEHICLE_ID, 1, -1,-1, -1, 300.0); afkvar[i] = 1; } }
|
Thanks, however the problem isn't to create them, the problem is to have them removed/destroyed
I'll give the above suggestion a try, and if it fails, i'll bump for more help
Edit:
It actually works to update the label instead of destroying it each time.
Thanks for the help.