SA-MP Forums Archive
3d Labels not deleting on user disconnect - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 3d Labels not deleting on user disconnect (/showthread.php?tid=112011)



3d Labels not deleting on user disconnect - ded - 05.12.2009

Code: http://pastebin.com/f2bb3a914

Basically, what happens is .. a player will go /away .. and then if he /quits whilst he is /away then rejoins .. all the information is still there, for example, they'll still be AFK and the 3D Label will remain until they type /back again. Anybody know wtf is going on?



Re: 3d Labels not deleting on user disconnect - Streetplaya - 05.12.2009

Quote:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(PlayerIsAFK[playerid] == 1) return PlayerIsAFK[playerid] = 0;
    if(Denied[playerid] == 1) return Denied[playerid] = 0;
    if(UsedAFK[playerid] == 1) return UsedAFK[playerid] = 0;
    if(AFK[playerid]!= INVALID_3DTEXT_ID) return Delete3DTextLabel(AFK[playerid]);
    return 1;
}
Why return at all these if checks?


Re: 3d Labels not deleting on user disconnect - ded - 05.12.2009

Well I did that to try and fix this issue, but it didn't work.


Re: 3d Labels not deleting on user disconnect - godknightx - 05.12.2009

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(PlayerIsAFK[playerid] == 1) PlayerIsAFK[playerid] = 0;
    if(Denied[playerid] == 1) Denied[playerid] = 0;
    if(UsedAFK[playerid] == 1) UsedAFK[playerid] = 0;
    if(AFK[playerid]!= INVALID_3DTEXT_ID) Delete3DTextLabel(AFK[playerid]);
    return 1;
}



Re: 3d Labels not deleting on user disconnect - ded - 05.12.2009

! That's what it was before.

I don't know why, or if it is anything to do with the issue at hand, but I am getting 2 tag mismatch warnings when I compile on lines 46 and 55.

46:
Код:
AFK[playerid] = INVALID_3DTEXT_ID;
55:
Код:
if(AFK[playerid]!= INVALID_3DTEXT_ID) Delete3DTextLabel(AFK[playerid]);



Re: 3d Labels not deleting on user disconnect - godknightx - 05.12.2009

Because the "AFK" variable is a number, not ?

pawn Код:
new Text3D:AFK[MAX_PLAYERS];
Or the INVALID_3DTEXT_ID is a number, and you cant use other types


Re: 3d Labels not deleting on user disconnect - ded - 05.12.2009

Anyone who knows what they are talking about, feel free to help me.