[Ajuda] Comando /admins - Help Me!
#1

Saudaзхes a todos!
Estou a muito tempo tentando passar meu /admins de texto em chat para Dialog Box.
Tentei varias vezes e nгo deu certo, mas encontrei recentemente um cуdigo que funcionou, mas ele estб sу aparecendo 1 admin quando tem mais de 1 na verdade!
Ele atй aparecia todos antes, mas aparecia atй quem nгo era adm, ai no lugar do nome ficava... Nгo hб admins online... Se alguйm tiver uma luz e puder me ajudar! Muito obrigado desde jб!

Код:
if (strcmp(cmd, "/admins", true) == 0)
    {
        new strtext[1000];
        new count = 0;
        if(IsPlayerConnected(playerid))
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {

                    if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] != 7 && Afk[i] ==0)
                    {
                        new admtext[40];
                        if(PlayerInfo[i][pAdmin] == 6) { admtext = "{EEDD82}Proprietбrio{FFFFFF}"; }
                        else if(PlayerInfo[i][pAdmin] == 5) { admtext = "{EEDD82}Elite{FFFFFF}"; }
				        else if(PlayerInfo[i][pAdmin] == 4) { admtext = "{EEDD82}Sub-Elite{FFFFFF}"; }
				        else if(PlayerInfo[i][pAdmin] == 3)	{ admtext = "{EEDD82}Moderador{FFFFFF}"; }
				        else if(PlayerInfo[i][pAdmin] == 2) { admtext = "{EEDD82}Sub-Moderador{FFFFFF}"; }
				        else if(PlayerInfo[i][pAdmin] == 1) { admtext = "{EEDD82}Recruta{FFFFFF}"; }
                        GetPlayerName(i, sendername, sizeof(sendername));
                        if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] <= 6)
                        {
                        format(string, 128, "{EEDD82}*{FFFFFF}%s (%s) - Disponнvel", sendername, admtext);
                        count++;
                        }
                        
                    }
                    if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] != 7 && Afk[i] ==1)
                    {
                        new admtext[40];
                        if(PlayerInfo[i][pAdmin] == 6) { admtext = "{EEDD82}Proprietбrio{FFFFFF}"; }
                        else if(PlayerInfo[i][pAdmin] == 5) { admtext = "{EEDD82}Elite{FFFFFF}"; }
				        else if(PlayerInfo[i][pAdmin] == 4) { admtext = "{EEDD82}Sub-Elite{FFFFFF}"; }
				        else if(PlayerInfo[i][pAdmin] == 3)	{ admtext = "{EEDD82}Moderador{FFFFFF}"; }
				        else if(PlayerInfo[i][pAdmin] == 2) { admtext = "{EEDD82}Sub-Moderador{FFFFFF}"; }
				        else if(PlayerInfo[i][pAdmin] == 1) { admtext = "{EEDD82}Recruta{FFFFFF}"; }
                        GetPlayerName(i, sendername, sizeof(sendername));
                        if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] <= 6)
                        {
                        format(string, 128, "{EEDD82}*{FFFFFF}%s (%s) - Ausente", sendername, admtext);
                        count++;
                        }
                    }
                    
                }
            }
        }
        if(count == 0)
        {
          format(string, 128, "{FFFFFF}Nгo hб administradores online agora!");
        }
        strcat(string, "\n");
        strcat(strtext, string);
        ShowPlayerDialog(playerid, 0xF, DIALOG_STYLE_MSGBOX,"{EEDD82}DARK STREET RPG - ADMINS ONLINE", strtext, "Ok",#);
        return PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
    }
Reply
#2

https://sampwiki.blast.hk/wiki/Strcat
Reply
#3

Desculpe mas voce nao ajudou em nada com isso, afinal ja tem no comando "strcat", entгo se vocк apontasse o erro seria melhor! Mesmo assim, obrigado!
Reply
#4

Quote:
Originally Posted by Don_Speed
Посмотреть сообщение
Estб correto oq ele disse, soh faltou organizaзгo no seu CMD para que funcionasse...

pawn Код:
if (strcmp(cmd, "/admins", true) == 0)
{
    new strtext[1000];
    new count = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] != 7 && Afk[i] ==0)
            {
                new admtext[40];
                if(PlayerInfo[i][pAdmin] == 6) { admtext = "{EEDD82}Proprietбrio{FFFFFF}"; }
                else if(PlayerInfo[i][pAdmin] == 5) { admtext = "{EEDD82}Elite{FFFFFF}"; }
                else if(PlayerInfo[i][pAdmin] == 4) { admtext = "{EEDD82}Sub-Elite{FFFFFF}"; }
                else if(PlayerInfo[i][pAdmin] == 3) { admtext = "{EEDD82}Moderador{FFFFFF}"; }
                else if(PlayerInfo[i][pAdmin] == 2) { admtext = "{EEDD82}Sub-Moderador{FFFFFF}"; }
                else if(PlayerInfo[i][pAdmin] == 1) { admtext = "{EEDD82}Recruta{FFFFFF}"; }
                GetPlayerName(i, sendername, sizeof(sendername));
                if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] <= 6)
                {
                    format(string, 128, "{EEDD82}*{FFFFFF}%s (%s) - Disponнvel\n", sendername, admtext);
                    strcat(strtext, string);
                    count++;
                }
            }
            if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] != 7 && Afk[i] ==1)
            {
                new admtext[40];
                if(PlayerInfo[i][pAdmin] == 6) { admtext = "{EEDD82}Proprietбrio{FFFFFF}"; }
                else if(PlayerInfo[i][pAdmin] == 5) { admtext = "{EEDD82}Elite{FFFFFF}"; }
                else if(PlayerInfo[i][pAdmin] == 4) { admtext = "{EEDD82}Sub-Elite{FFFFFF}"; }
                else if(PlayerInfo[i][pAdmin] == 3) { admtext = "{EEDD82}Moderador{FFFFFF}"; }
                else if(PlayerInfo[i][pAdmin] == 2) { admtext = "{EEDD82}Sub-Moderador{FFFFFF}"; }
                else if(PlayerInfo[i][pAdmin] == 1) { admtext = "{EEDD82}Recruta{FFFFFF}"; }
                GetPlayerName(i, sendername, sizeof(sendername));
                if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] <= 6)
                {
                    format(string, 128, "{EEDD82}*{FFFFFF}%s (%s) - Ausente\n", sendername, admtext);
                    strcat(strtext, string);
                    count++;
                }
            }
        }
    }
    if(count == 0) format(string, 128, "{FFFFFF}Nгo hб administradores online agora!");
    ShowPlayerDialog(playerid, 0xF, DIALOG_STYLE_MSGBOX,"{EEDD82}DARK STREET RPG - ADMINS ONLINE", strtext, "Ok",#);
    return PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
Reply
#5

Putz cara... que show... funcionou direitinho mano! Agora eu entendi, eu achei que se eu colocasse uma ъnica strcat(strtext, string); antes do ShowPlayerDialog(... iria captar todas as format(string....! Boa, saquei a lуgica agora! Muito obrigado paulor! +Rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)