[Ajuda] comando /admins onlines
#1

Bom pessoal minha gm tem o comando /admins para ver os admins onlines mas quando ha mais de 4 ou cinco adm's pra cima a dialog buga ja peguei varios codigos da msm natureza mais ainda fica bugado. O comando й esse:

PHP код:
    if(strcmp(cmd"/admins"true) == 0)
    {
        new 
count 0;
        new 
strcmd[1000];
        for(new 
0MAX_PLAYERSi++)
        {
            
format(Afilesizeof(Afile), PASTA_ADMINSGetPlayerNameEx(i));
            if(
DOF2_GetInt(Afile"Level") > 1)
            {
                if(
DOF2_GetInt(Afile"ALevel") == 1)
                {
                    if(
AFK[playerid] == 0)
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ AJUDANTE™ ]\t\t{00FF00}[ ON ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                    else
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ AJUDANTE™ ]\t\t{FF0000}[ OFF ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                }
                if(
DOF2_GetInt(Afile"ALevel") == 2)
                {
                    if(
AFK[playerid] == 0)
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ ADMINISTRADOR™ ]\t\t{00FF00}[ ON ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                    else
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ ADMINISTRADOR™ ]\t\t{FF0000}[ OFF ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                }
                if(
DOF2_GetInt(Afile"ALevel") == 3)
                {
                    if(
AFK[playerid] == 0)
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ GERENTE™ ]\t\t{00FF00}[ ON ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                    else
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ GERENTE™ ]\t\t{FF0000}[ OFF ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                }
                if(
DOF2_GetInt(Afile"ALevel") == 4)
                {
                    if(
AFK[playerid] == 0)
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ SUB-DONO™ ]\t\t{00FF00}[ ON ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                    else
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ SUB-DONO™ ]\t\t{FF0000}[ OFF ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                }
                if(
DOF2_GetInt(Afile"ALevel") == 5)
                {
                    if(
AFK[playerid] == 0)
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ DONO™ ]\t\t{00FF00}[ ON ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                    else
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ DONO™ ]\t\t{FF0000}[ OFF ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                }
                if(
DOF2_GetInt(Afile"ALevel") == 6)
                {
                    if(
AFK[playerid] == 0)
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ SCRIPTER™ ]\t\t{00FF00}[ ON ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                    else
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ SCRIPTER™ ]\t\t{FF0000}[ OFF ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                }
                if(
DOF2_GetInt(Afile"ALevel") == 7)
                {
                    if(
AFK[playerid] == 0)
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ MAPPER™ ]\t\t{00FF00}[ ON ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                    else
                    {
                        
format(strcmdsizeof(strcmd), "{FFFFFF}%s [%d]\t{00FF00}[ MAPPER™ ]\t\t{FF0000}[ OFF ]\n"GetPlayerNameEx(i), i);
                        
strcat(stringstrcmdsizeof(string));
                    }
                }
                
count++;
            }
        }
        if(
count == 0)
        {
            
ShowPlayerDialog(playeridplayersimpDIALOG_STYLE_MSGBOX"{FFFFFF}ADM's Online [ {FF0000}0{FFFFFF} ]""{FF0000}Nгo hб menbros da Administraзгo Online""OK""");
        }
        else
        {
            new 
msg[150], strcount[150];
            
format(msgsizeof(msg), "{FFFFFF}ADM's Online [ {00FF00}%d{FFFFFF} ]"count);
            
strcat(strcountmsgsizeof(strcount));
            
ShowPlayerDialog(playeridplayersimpDIALOG_STYLE_MSGBOXstrcountstring"OK""");
        }
        return 
1;
    } 
para vcs terem como base. Se tiverem alguma forma de aperfeiзoar eu agradeзo
Reply
#2

Код:
if(admin_Level[i] >= 1 && IsPlayerConnected(i))
Reply
#3

Quote:
Originally Posted by MrToddyYT
Посмотреть сообщение
Код:
if(admin_Level[i] >= 1 && IsPlayerConnected(i))
nao entendi?

vai da erro tb
Reply
#4

Tem muitas formas de aperfeiзoar. Esse cуdigo estб muito mau. Pelo que parece vocк andou a copiar comandos de outros GM's atй encontrar um que funcionasse +/- no seu GM.

PHP код:
new 0str[512];
for(new 
0MAX_PLAYERSi++) {
    if(!
IsPlayerOnline(i)) continue;
    if(
VariavelAdmin[i] != 0) {
        new 
temp[128];
        
format(tempsizeof temp"%s estб online"GetPlayerNameEx(i));
        
strcat(strtempsizeof str);
    }
    
c++;
}
if(
== 0) {
    
// mesagem nao ha admins online
} else {
    
// mostrar dialog com o conteudo da string str

A base й esta, agora adapte ao seu GM. Nгo compilei, pode ter erros. Agora nгo diga que dб undefined symbol "VariavelAdmin".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)