[Help] Attach3DTextLabelToPlayer
#1

I give the command below (entering duty mode), and it creates the 3DLabel normally, and appears on top of the administrator name "Admin" in blue, but when I give the command again (to exit duty mode) the 3DLabel does not exit, someone know why?

PHP код:
ACMD:admin[1](playeridparams[])
{    
    if(
GetPlayerAdminLevel(playerid) < 2)
        return 
Msg(playeridRED"[ > ] Vocк nгo tem permissгo para usar este comando.");
    new 
name[MAX_PLAYER_NAME];
    new 
Text3D:adminindicitor[MAX_PLAYERS];
    
GetPlayerName(playeridnamesizeof(name));
    if(
GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
    {
        
Msg(playeridRED"[ > ] Vocк nгo pode fazer isso enquanto estб espiando!");
        return 
1;
    }
    if(!
IsPlayerOnAdminDuty(playerid))
    {    
        
adminindicitor[playerid] = Create3DTextLabel("Admin"0x33CCFFFF30.040.050.010.00);
        
TogglePlayerAdminDuty(playeridtrue);
        
MsgAdminsF(1NovoA"[ > ] O(a) Administrador(a){FFFFFF} %s {00c0ff}saiu do modo jogador!"name);
        
Attach3DTextLabelToPlayer(adminindicitor[playerid], playerid0.00.00.2);
    }
    else
    {    
        
TogglePlayerAdminDuty(playeridfalse);
        
MsgAdminsF(1NovoA"[ > ] O(a) Administrador(a){FFFFFF} %s {00c0ff}entrou no modo jogador!"name);
           
Delete3DTextLabel(adminindicitor[playerid]);
    }
    return 
1;

Reply
#2

Your
Код:
adminindicitor
Variable is local.

So it gets resetted every time the command is called.

You have to declare it global (out of the command), so that is saved.

(Or change from
Код:
new
to
Код:
static
)
Reply
#3

It worked !, Thank you <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)