Dynamic 3d text labels - issues destroying properly
#1

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"0xEE0000AA0.00.01.340.0iINVALID_VEHICLE_ID1, -1,-1, -1300.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.
Reply
#2

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
Reply
#3

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.
Reply
#4

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;  
    }
}
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)