SA-MP Forums Archive
[ajuda] /admins - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [ajuda] /admins (/showthread.php?tid=335072)



[ajuda] /admins - Victor_Souz4 - 17.04.2012

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;
}



Re: [ajuda] /admins - ViniBorn - 17.04.2012

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".


Re: [ajuda] /admins - Victor_Souz4 - 17.04.2012

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


Re: [ajuda] /admins - ViniBorn - 17.04.2012

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


Re: [ajuda] /admins - Victor_Souz4 - 17.04.2012

Poderia me ajudar a solucionar ?


Re: [ajuda] /admins - zSuYaNw - 17.04.2012

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;
}