SA-MP Forums Archive
3DTextLabel Bug! - 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: 3DTextLabel Bug! (/showthread.php?tid=160776)



3DTextLabel Bug! - iZN - 17.07.2010

I have created these 3DText Label's:
pawn Code:
if(IsPlayerDAdminByDeadly[playerid][Level] == 3) {
    label1[playerid] = Create3DTextLabel("HEAD ADMINISTRATOR",0x7CFC0075,30.0,40.0,50.0,40.0,0);
    Attach3DTextLabelToPlayer(label1[playerid], playerid, 0.0, 0.0, 0.7);
    }
    else
    if(IsPlayerDAdminByDeadly[playerid][Level] == 2) {
    label1[playerid] = Create3DTextLabel("ADMINISTRATOR",0x7CFC0075,30.0,40.0,50.0,40.0,0);
    Attach3DTextLabelToPlayer(label1[playerid], playerid, 0.0, 0.0, 0.7);
    }
    else
    if(IsPlayerDAdminByDeadly[playerid][Level] == 1) {
    label1[playerid] = Create3DTextLabel("MODERATOR",0x7CFC0075,30.0,40.0,50.0,40.0,0);
    Attach3DTextLabelToPlayer(label1[playerid], playerid, 0.0, 0.0, 0.7);
    }
    else
    if(IsPlayerDAdminByDeadly[playerid][pVip] == 0) {
    label1[playerid] = Create3DTextLabel("DONATOR",0x7CFC0075,30.0,40.0,50.0,40.0,0);
    Attach3DTextLabelToPlayer(label1[playerid], playerid, 0.0, 0.0, 0.7);
    }
    else
    if(IsPlayerDAdminByDeadly[playerid][Level] == 0) {
    label2[playerid] = Create3DTextLabel("  ",0x008080FF,30.0,40.0,50.0,40.0,0);
    Attach3DTextLabelToPlayer(label2[playerid], playerid, 0.0, 0.0, 0.7);
    }
The problem is that, the player who is level 0, it shows it Head Admin (means Level 3) and sometime it shows Donator (Vip Member) and he's not a vip member too! Can anybody tell me what's the problem with my script?
These are added in OnPlayerSpawn callback and it's not only bugging with level 0, it also bugs with level 1, 2 and 3 too, it shows double 3D


Re: 3DTextLabel Bug! - iZN - 18.07.2010

Bumping it!


Re: 3DTextLabel Bug! - aNdReSk - 18.07.2010

IsPlayerDAdminByDeadly[playerid][Level]=0;
IsPlayerDAdminByDeadly[playerid][pVip]=0;

do u have that on player disconnect?

cuz if a player disconnects next player with same ID would have those preferences already set!


Re: 3DTextLabel Bug! - iZN - 18.07.2010

Yep, both are on OnPlayerDisconnect callback...


Re: 3DTextLabel Bug! - straco - 18.07.2010

you create label on every spawn ?

try to create label only on player login and when dissconect delete label or update to " "


Re: 3DTextLabel Bug! - iZN - 18.07.2010

Yeah, on every spawn.
okay, I'll try.....


Re: 3DTextLabel Bug! - Lemmur95 - 19.07.2010

Do it only OnGameModeInit() a not anywhere else! Only one time


Re: 3DTextLabel Bug! - Betamaster - 19.07.2010

You actually need to do a combination of what people have previously suggested.

Create your 3D labels (Create3DTextLabel) in OnGameModeInit:

pawn Code:
label1 = Create3DTextLabel("HEAD ADMINISTRATOR",0x7CFC0075,30.0,40.0,50.0,40.0,0);
label2 = Create3DTextLabel("ADMINISTRATOR",0x7CFC0075,30.0,40.0,50.0,40.0,0);
label3 = Create3DTextLabel("MODERATOR",0x7CFC0075,30.0,40.0,50.0,40.0,0);
label4 = Create3DTextLabel("DONATOR",0x7CFC0075,30.0,40.0,50.0,40.0,0);
Then once the player is logged in, presumably in OnPlayerConnect (or whenever IsPlayerDAdminByDeadly[playerid][Level] and IsPlayerDAdminByDeadly[playerid][pVip] will return correct values), attach the label to the player.

pawn Code:
switch(IsPlayerDAdminByDeadly[playerid][Level]) {
    case 3: Attach3DTextLabelToPlayer(label1, playerid, 0.0, 0.0, 0.7);
    case 2: Attach3DTextLabelToPlayer(label2, playerid, 0.0, 0.0, 0.7);
    case 1: Attach3DTextLabelToPlayer(label3, playerid, 0.0, 0.0, 0.7);
    default: {
        if(IsPlayerDAdminByDeadly[playerid][pVip] == 0) {
            Attach3DTextLabelToPlayer(label4, playerid, 0.0, 0.0, 0.7);
        }
    }
}