Help with text labels!
#1

Hello. I have a bug related to the text labels for admins when they go on duty. Basically, when they go on duty, the text label appears on them, everything is fine, but the problem is, that the same text label ''Admin On Duty'' also appears on normal players. I think it appears on them, when they connect to the server, but not sure.

Please help me to fix this. Thank you!
Reply
#2

Codes?
How do you expect to get help like that, We wont guess how you scripted your textlabels or however..
I suggest you to destory textlabels in onplayerdiconnect callback
Reply
#3

PHP код:
new Text3D:labela[MAX_PLAYERS];
public 
OnPlayerDisconnect(playeridreason)
{
Delete3DTextLabel(labela[playerid]);
}
return 
1;
CMD:aod(playerid)
{
    if(
pInfo[playerid][pLogged] == 1)
    {
        if(
pInfo[playerid][pAdminLevel] >= 1)
        {
            if(
pInfo[playerid][pAdminDuty] == 0)
            {
            
pInfo[playerid][pAdminDuty] = 1;
            new 
adutyonstring[128];
            
format(adutyonstringsizeof(adutyonstring), "{DC143C}Administrator %s is now On Duty!" ,PlayerName(playerid));
            
SendClientMessageToAll(-1,adutyonstring);
            
SetPlayerColor(playerid,0xFFFFFF00);
            
SetPlayerSkin(playerid217);
            
SetPlayerHealth(playerid,999999.0);
            
//labela[playerid] = Create3DTextLabel("Admin On Duty", 0x00FF00FF, 30.0, 40.0, 50.0, 40.0, 0);
            //Attach3DTextLabelToPlayer(labela[playerid], playerid, 0.0, 0.0, 0.7);
            
SendClientMessage(playerid,COLOR_RED,""chat" Remember to /aod when you play as a regular player.");
            }
            else
            {
                if(
pInfo[playerid][pAdminDuty] == 1)
                {
                
pInfo[playerid][pAdminDuty] = 0;
                new 
adutyoffstring[128];
                
Delete3DTextLabel(labela[playerid]);
                
ResetPlayerWeaponsEx(playerid23,25);
                
format(adutyoffstringsizeof(adutyoffstring), "{DC143C}Administrator %s is now Off Duty." ,PlayerName(playerid));
                
SendClientMessageToAll(-1,adutyoffstring);
                if(
team[playerid] == TEAM_ZOMBIE)
                {
                    
SetPlayerColor(playerid,COLOR_ZOMBIE);
                }
                if(
team[playerid] == TEAM_HUMAN)
                {
                    
SetPlayerColor(playerid,COLOR_HUMAN);
                }
                
SetPlayerHealth(playerid,100);
                }
            }
        }
    }
    else if(
pInfo[playerid][pLogged] == 0)
    {
        
//SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" Nice try , KICKED!");
        
printf("%s has been kicked for trying to use a command without being logged in!"PlayerName(playerid));
        
Kick(playerid);
    }
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    if(
pInfo[playerid][pAdminDuty] == 1)
    {
        
pInfo[playerid][pAdminDuty] = 0;
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)