loop with dialogue
#1

Hello! I have a problem, like the image shown below, the dialog skips a line and show what should be shown, over the first line of dialogue I get the error, how can I fix?



PHP код:
    if (strcmp(cmd"/admins"true) == 0)
    {
        new 
count 0dialog1[1000], adm[25];
        for (new 
0MAX_PLAYERSi++)
        {
            if (
IsPlayerConnected(i))
            {
                if (
AccountData[i][pAdmin] >= 0)
                {
                    if (
ModociaAdm3000[i] == 0)
                    {
                        switch (
AccountData[i][pAdmDuty])
                        {
                            case 
0:
                            {
                                if (
AccountData[i][pAdmin] == 0)
                                {
                                    
format(admsizeof dialog1"Moderador: %s [Trabalhando]\n"GetPlayerNameRP(i));
                                    
strcat(dialog1admsizeof dialog1);
                                    
count++;
                                }
                                else if (
AccountData[i][pAdmin] >= 1)
                                {
                                    
format(admsizeof dialog1"Admin [%d]: %s [Trabalhando]\n"AccountData[i][pAdmin], GetPlayerNameRP(i));
                                    
strcat(dialog1admsizeof dialog1);
                                    
count++;
                                }
                            }
                            case 
1:
                            {
                                if (
AccountData[i][pAdmin] == 0)
                                {
                                    
format(admsizeof dialog1"Moderador: %s [Jogando]\n"GetPlayerNameRP(i));
                                    
strcat(dialog1admsizeof dialog1);
                                    
count++;
                                }
                                else if (
AccountData[i][pAdmin] >= 1)
                                {
                                    
format(admsizeof dialog1"Admin [%d]: %s [Jogando]\n"AccountData[i][pAdmin], GetPlayerNameRP(i));
                                    
strcat(dialog1admsizeof dialog1);
                                    
count++;
                                }
                            }
                        }
                    }
                }
                if (
count == 0ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"ERRO""Nгo hб nenhum admin/moderador online""Fechar""");
            }
        }
        
ShowPlayerDialog(playerid0DIALOG_STYLE_LIST"Administraзгo"dialog1"Fechar""");
        return 
1;
    } 
Reply
#2

up!!!!
Reply
#3

What error you've getting ?
Reply
#4

Quote:
Originally Posted by KillerDVX
Посмотреть сообщение
What error you've getting ?


Hello friend, the error is above, shows in [Trabalho]
Reply
#5

I don't get your problem, please illustrate more.
Reply
#6

[I]Would you try this code ? :

PHP код:
if (strcmp(cmd"/admins"true) == 0
    { 
        new 
count 0dialog1[1000], adm[25], adm1[25];
        for (new 
0MAX_PLAYERSi++) 
        { 
            if (
IsPlayerConnected(i)) 
            { 
                if (
AccountData[i][pAdmin] >= 0
                { 
                    if (
ModociaAdm3000[i] == 0
                    { 
                        switch (
AccountData[i][pAdmDuty]) 
                        { 
                            case 
0
                            { 
                                if (
AccountData[i][pAdmin] == 0
                                { 
                                    
format(admsizeof dialog1"Moderador: %s [Trabalhando]\n"GetPlayerNameRP(i)); 
                                    
strcat(dialog1adm1sizeof dialog1); 
                                    
count++; 
                                } 
                                else if (
AccountData[i][pAdmin] >= 1
                                { 
                                    
format(admsizeof dialog1"Admin [%d]: %s [Trabalhando]\n"AccountData[i][pAdmin], GetPlayerNameRP(i)); 
                                    
strcat(dialog1adm1sizeof dialog1); 
                                    
count++; 
                                } 
                            } 
                            case 
1
                            { 
                                if (
AccountData[i][pAdmin] == 0
                                { 
                                    
format(admsizeof dialog1"Moderador: %s [Jogando]\n"GetPlayerNameRP(i)); 
                                    
strcat(dialog1adm1sizeof dialog1); 
                                    
count++; 
                                } 
                                else if (
AccountData[i][pAdmin] >= 1
                                { 
                                    
format(admsizeof dialog1"Admin [%d]: %s [Jogando]\n"AccountData[i][pAdmin], GetPlayerNameRP(i)); 
                                    
strcat(dialog1adm1sizeof dialog1); 
                                    
count++; 
                                } 
                            } 
                        } 
                    } 
                } 
                if (
count == 0ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"ERRO""Nгo hб nenhum admin/moderador online""Fechar"""); 
            } 
        } 
        
ShowPlayerDialog(playerid0DIALOG_STYLE_LIST"Administraзгo"dialog1"Fechar"""); 
        return 
1
    }  [/
i


Not pretty sure, but just try it ^^

KillerDVX,
Reply
#7

pawn Код:
adm[25];
So, what you're probably doing wrong is expecting his playername (up to 24 chars), and the administration rank (~ 11 chars including ':' and space ' '), + [Trabalhando] which is 14 chars including space ' '...

All of this adds up to ~50 chars, so why don't you set it to at least that

pawn Код:
adm[64];
and also change

pawn Код:
format(adm, sizeof dialog1,
to

pawn Код:
format(adm, sizeof(adm),
(There is no way you will need 1000 bytes in the 'adm' array)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)