[ajuda] /admins
#1

o bug й que mesmo que tenha 2 admins so aparece 1 na dialog:

pawn Код:
if(strcmp(cmd, "/admins", true) == 0)
{
    new count = 0;
    new str[150],strin[150];
    new pname[MAX_PLAYER_NAME];
    foreach(Player, i) {
        if(logged[i] == 1) {
            if(PlayerInfo[i][pAdmin] >= 1) {
                PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
                GetPlayerName(i, pname, MAX_PLAYER_NAME);
                format(str, sizeof(str), "Administrador: %s id:%d - Nнvel: %d\n",pname,i,PlayerInfo[i][pAdmin]);
                strcat(strin, str, sizeof(strin));
                count++;
            }
        }
    }
    ShowPlayerDialog(playerid, 7327, DIALOG_STYLE_MSGBOX, "Administradores\n\n", strin, "Fechar", "");
    if(count == 0) {
        PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        strcat(str,"{FFA500}Nenhum administrador ativo.");
        ShowPlayerDialog(playerid, 1973, DIALOG_STYLE_MSGBOX, "Administradores\n\n", str, "Fechar", "");
    }
    return 1;
}
Reply
#2

pawn Код:
new str[150],strin[150];

strcat(strin, str, sizeof(strin));
Nгo faz sentido ter uma "string-origem" do tamanho de uma "string-destino".
Reply
#3

pawn Код:
if(strcmp(cmd, "/admins", true) == 0)
{
    new count = 0;
    new str[100];
    new pname[MAX_PLAYER_NAME];
    foreach(Player, i) {
        if(logged[i] == 1) {
            if(PlayerInfo[i][pAdmin] >= 1) {
                PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
                GetPlayerName(i, pname, MAX_PLAYER_NAME);
                format(str, sizeof(str), "Administrador: %s id:%d - Nнvel: %d\n",pname,i,PlayerInfo[i][pAdmin]);
                strcat(str, str, sizeof(str));
                count++;
            }
        }
    }
    ShowPlayerDialog(playerid, 7327, DIALOG_STYLE_MSGBOX, "Administradores\n\n", str, "Fechar", "");
    if(count == 0) {
        PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        strcat(str,"{FFA500}Nenhum administrador ativo.");
        ShowPlayerDialog(playerid, 1973, DIALOG_STYLE_MSGBOX, "Administradores\n\n", str, "Fechar", "");
    }
    return 1;
}
Certo entaum seria assim? mas do mesmo geito n pega
Reply
#4

Essa nгo й a soluзгo do problema, й sу uma observaзгo.
Reply
#5

Poderia me ajudar a solucionar ?
Reply
#6

Tente isto:
pawn Код:
if(strcmp(cmd, "/admins", true) == 0)
{
    new count = 0;
    new ,strin[150];
    new pname[MAX_PLAYER_NAME];
    foreach(Player, i){
        if(logged[i] == 1) {
            if(PlayerInfo[i][pAdmin] >= 1) {
             //   PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
                GetPlayerName(i, pname, MAX_PLAYER_NAME);
                new tstr[100];
                format(tstr, sizeof(tstr), "Administrador: %s id:%d - Nнvel: %d\n",pname,i,PlayerInfo[i][pAdmin]);
                strcat(strin, tstr);
                count++;
            }
        }
    }
    ShowPlayerDialog(playerid, 7327, DIALOG_STYLE_MSGBOX, "Administradores\n\n", strin, "Fechar", "");
    if(count == 0) {
        PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        strcat(str,"{FFA500}Nenhum administrador ativo.");
        ShowPlayerDialog(playerid, 1973, DIALOG_STYLE_MSGBOX, "Administradores\n\n", str, "Fechar", "");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)