[Ajuda] Comando esta bugado.
#1

Esse meu /admins esta bugado. Tipo quando tem 2 admins online nгo aparece os dois. sу aparece 1. Alguйm pode me ajuda.

PHP код:
*CMD:admins(playeridparams[])
 {
        foreach(
Playeri)
        {
            if(
PlayerInfo[i][pAdmin] > 0)
            {
                if(
admhide[i] == 0)
                {
                    
GetPlayerName(isendernamesizeof(sendername));
                    new 
string[200];
                    if(
admtrampando[i] == 1)
                    {
                        if(
PlayerInfo[i][pAdmin] == 1337)
                            
format(string128"Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Master{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]"sendername,PlayerInfo[i][pFuncao]);
                        else if(
PlayerInfo[i][pAdmin] == 3001)
                            
format(string128"Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Subdono{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]"sendername,PlayerInfo[i][pFuncao]);
                        else if(
PlayerInfo[i][pAdmin] == 5000)
                            
format(string128"Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Fundador{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]"sendername,PlayerInfo[i][pFuncao]);
                        else if(
PlayerInfo[i][pAdmin] == 1338)
                            
format(string128"Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Gerente{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]"sendername,PlayerInfo[i][pFuncao]);
                        else
                            
format(string128"Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}%d{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]"sendernamePlayerInfo[i][pAdmin],PlayerInfo[i][pFuncao]);
                        
ShowPlayerDialog(playerid1010DIALOG_STYLE_LIST"Administradores Online",string,"Confirmar","Cancelar");
                    }
                    else
                    {
                        if(
PlayerInfo[i][pAdmin] == 1337)
                            
format(string128"Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Master{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]"sendername,PlayerInfo[i][pFuncao]);
                        else if(
PlayerInfo[i][pAdmin] == 3001)
                            
format(string128"Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Subdono{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]"sendername,PlayerInfo[i][pFuncao]);
                        else if(
PlayerInfo[i][pAdmin] == 5000)
                            
format(string128"Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Fundador{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]"sendername,PlayerInfo[i][pFuncao]);
                        else if(
PlayerInfo[i][pAdmin] == 1338)
                            
format(string128"Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Gerente{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]"sendername,PlayerInfo[i][pFuncao]);
                        else
                            
format(string128"Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}%d{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]"sendernamePlayerInfo[i][pAdmin],PlayerInfo[i][pFuncao]);
                        
ShowPlayerDialog(playerid1010DIALOG_STYLE_LIST"Administradores Online",string,"Confirmar","Cancelar");
                    }
                }
            }
            if(
PlayerInfo[i][pAdminTemp] > 0)
            {
                if(
admhide[i] == 0)
                {
                    
GetPlayerName(isendernamesizeof(sendername));
                    new 
string[128];
                    if(
admtrampando[i] == 1)
                    {
                        
format(string128"Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Temporбrio{B4B5B7}]"sendername);
                        
ShowPlayerDialog(playerid1010DIALOG_STYLE_LIST"Administradores Online",string,"Confirmar","Cancelar");
                    }
                    else
                    {
                        
format(string128"Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Temporбrio{B4B5B7}] {FFFFFF}[Jogando]"sendername);
                       
ShowPlayerDialog(playerid1010DIALOG_STYLE_LIST"Administradores Online",string,"Confirmar","Cancelar");
                    }
                }
            }
        }
        return 
true;
    } 
Reply
#2

Tipo, vocк tem que colocar %s\n%s\n%s

O mais certo й vc fazer uma stock GetNameAdmin e puxar o nome por id, depois disso vocк puxa no string a stock... exemplo:

pawn Код:
format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}%s{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]", sendername, getadminname(i), PlayerInfo[i][pFuncao]);
Dessa forma ele puxa tudo e fica 1 linha apenas

ou talvez vocк pode tentar assim:

pawn Код:
CMD:admins(playerid, params[])
 {

        foreach(Player, i)
        {
            if(PlayerInfo[i][pAdmin] > 0)
            {
                if(admhide[i] == 0)
                {
                    GetPlayerName(i, sendername, sizeof(sendername));
                    new string[200];
                    if(admtrampando[i] == 1)
                    {
                        if(PlayerInfo[i][pAdmin] == 1337)
                            format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Master{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]\n", sendername,PlayerInfo[i][pFuncao]);
                        else if(PlayerInfo[i][pAdmin] == 3001)
                            format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Subdono{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]\n", sendername,PlayerInfo[i][pFuncao]);
                        else if(PlayerInfo[i][pAdmin] == 5000)
                            format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Fundador{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]\n", sendername,PlayerInfo[i][pFuncao]);
                        else if(PlayerInfo[i][pAdmin] == 1338)
                            format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Gerente{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]\n", sendername,PlayerInfo[i][pFuncao]);
                        else
                            format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}%d{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]\n", sendername, PlayerInfo[i][pAdmin],PlayerInfo[i][pFuncao]);
                        ShowPlayerDialog(playerid, 1010, DIALOG_STYLE_LIST, "Administradores Online",string,"Confirmar","Cancelar");
                    }
                    else
                    {
                        if(PlayerInfo[i][pAdmin] == 1337)
                            format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Master{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]\n", sendername,PlayerInfo[i][pFuncao]);
                        else if(PlayerInfo[i][pAdmin] == 3001)
                            format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Subdono{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]", sendername,PlayerInfo[i][pFuncao]);
                        else if(PlayerInfo[i][pAdmin] == 5000)
                            format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Fundador{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]\n", sendername,PlayerInfo[i][pFuncao]);
                        else if(PlayerInfo[i][pAdmin] == 1338)
                            format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Gerente{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]\n", sendername,PlayerInfo[i][pFuncao]);
                        else
                            format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}%d{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]\n", sendername, PlayerInfo[i][pAdmin],PlayerInfo[i][pFuncao]);
                        ShowPlayerDialog(playerid, 1010, DIALOG_STYLE_LIST, "Administradores Online",string,"Confirmar","Cancelar");
                    }
                }
            }
            if(PlayerInfo[i][pAdminTemp] > 0)
            {
                if(admhide[i] == 0)
                {
                    GetPlayerName(i, sendername, sizeof(sendername));
                    new string[128];
                    if(admtrampando[i] == 1)
                    {
                        format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Temporбrio{B4B5B7}]\n", sendername);
                        ShowPlayerDialog(playerid, 1010, DIALOG_STYLE_LIST, "Administradores Online",string,"Confirmar","Cancelar");
                    }
                    else
                    {
                        format(string, 128, "Admin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Temporбrio{B4B5B7}] {FFFFFF}[Jogando]\n", sendername);
                       ShowPlayerDialog(playerid, 1010, DIALOG_STYLE_LIST, "Administradores Online",string,"Confirmar","Cancelar");
                    }
                }
            }
        }
        return true;
    }
й um chute na vdd
Reply
#3

Irei testa esse
Reply
#4

Vocк esta mostrando o dialogo e criando uma string dentro do loop, o certo й vocк usar uma string para formatar e uma para armazenas os nomes jб formatados e fora do loop mostrar o dialogo.

Exemplo:
PHP код:
new stf[1], str[1];
//loop
    //caso for admin
    //formata uma linha
    
format(stfsizeof stf"...\n");
    
//armazena na string principal
    
strcat(strstfsizeof str);
//fim do loop

//verifica se a string str esta vazia
if(str[0] == EOS)
    
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Admins""Nenhum admin""OK""");
else
    
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Admins"str"OK"""); 
Veja as funзхes format e strcat.
Reply
#5

Vocк estб setando todas as informaзхes em uma so string, e nгo esta chamando a dialog no ponto correto.

PHP код:
            if(!strcmp(cmd"/admins"true))
            {
                new
                      
MODON[128], ADMON[128], PROON[128],
                    
MADMS[200], aAFK[30], M_O_DA_D_MP_R_O
                
;
                for(new 
0MAX_PLAYERSi++)
                {
                    new 
NickMongolao[128];
                    
GetPlayerName(iNickMongolao);
                    
//if(Geta se o player nao esta afk[i] == 0)
                    
{
                        
format(aAFK,sizeof aAFK,"{00DF00}Online");
                    }
                    
//else if(Geta se o player esta afk[i] == 1)
                    
{
                        
format(aAFK,sizeof aAFK,"{FF8B17}Ausкnte");
                    }
                    
//if(Verifica o nivel de ADM[i] == 1)
                    
{
                           
format(MODON,sizeof MODON,"%s%s[Moderador(a)] %s %s\n"MODONNickMongolaoaAFKpInfo[i][pFuncao]);
                        
M_O_D ++;
                       }
                    
//if(Verifica o nivel de ADM[i] == 2)
                    
{
                           
format(ADMON,sizeof ADMON,"%s%s[Administrador(a)] %s %s\n"ADMONNickMongolaoaAFKpInfo[i][pFuncao]);
                        
A_D_M ++;
                       }
                    
//if(Verifica o nivel de ADM[i] == 3)
                    
{
                           
format(PROON,sizeof PROON,"%s%s[Programador(a)] %s %s\n"PROONNickMongolaoaAFKpInfo[i][pFuncao]);
                        
P_R_O ++;
                       }
                }
                if(
M_O_D == && A_D_M == && P_R_O == 0)
                {
                    
format(MADMS,sizeof MADMS,"Nenhum Staff Online no momento.");
                    
ShowPlayerDialog(playerid999DIALOG_STYLE_MSGBOX"Membros Staffs Conectados"MADMS"Fechar""");
                }
                else
                {
                       
format(MADMS,sizeof MADMS,"%s%s%s"PROONADMONMODON);
                       
ShowPlayerDialog(playerid999DIALOG_STYLE_LIST"Membros Staffs Conectados"MADMS"Ok""Fechar");
                }
                return 
1;
            } 
Usei um que fiz pra vc usar de base e adicionar suas caracteristicas no code. Fiz em strcmp so converta pra zCMD e foreach
Reply
#6

Estou tentando criar quebrando a linha /n mas nao estou conseguindo pois nao ler os dois admins que estao no servidor
Reply
#7

ainda esta dando ms problema alguem pode ajuda
Reply
#8

Код HTML:
CMD:admins(playerid)
{
	static string[3000];
 	string[0] = EOS;
	new bool:sucess = false;
    foreach(Player, i)
    {
        if(PlayerInfo[i][pAdmin] > 0)
        {
		 	GetPlayerName(i, sendername, sizeof(sendername));
            if(admhide[i] == 0)
			{
                if(admtrampando[i] == 1)
                {
                    switch(PlayerInfo[i][pAdmin])
                    {
                        case 1337: format(string,sizeof(string),"%sAdmin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Master{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]\n",string, sendername,PlayerInfo[i][pFuncao]);
                        case 3001: format(string,sizeof(string),"%sAdmin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Subdono{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]\n",string,sendername,PlayerInfo[i][pFuncao]);
                        case 5000: format(string,sizeof(string),"%sAdmin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Fundador{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]\n",string,sendername,PlayerInfo[i][pFuncao]);
                        case 1338: format(string,sizeof(string),"%sAdmin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Gerente{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]\n",string,sendername,PlayerInfo[i][pFuncao]);
                        default: format(string,sizeof(string),"%sAdmin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}%d{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}]\n",string, sendername,PlayerInfo[i][pAdmin],PlayerInfo[i][pFuncao]);
                    }
                    if(!sucess) sucess = true;
                }
                else
                {
                    switch(PlayerInfo[i][pAdmin])
                    {
                        case 1337: format(string,sizeof(string),"%sAdmin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Master{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]\n", string,sendername,PlayerInfo[i][pFuncao]);
                        case 3001: format(string,sizeof(string),"%sAdmin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Subdono{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]\n", string,sendername,PlayerInfo[i][pFuncao]);
                        case 5000: format(string,sizeof(string),"%sAdmin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Fundador{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]\n", string,sendername,PlayerInfo[i][pFuncao]);
                        case 1338: format(string,sizeof(string),"%sAdmin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Gerente{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]\n", string,sendername,PlayerInfo[i][pFuncao]);
                        default: format(string,sizeof(string),"%sAdmin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}%d{B4B5B7}] Funзгo:[{FFFFFF}%s{B4B5B7}] {FFFFFF}[Jogando]\n", string, sendername, PlayerInfo[i][pAdmin],PlayerInfo[i][pFuncao]);
                    }
                    if(!sucess) sucess = true;
                }
            }
        }
        if(PlayerInfo[i][pAdminTemp] > 0)
        {
            if(admhide[i] == 0)
            {
                format(string,sizeof(string),"%sAdmin: {FFFFFF}%s {B4B5B7}Nнvel:[{FFFFFF}Temporбrio{B4B5B7}] {FFFFFF}%s\n",string, sendername, (admtrampando[i] == 1 ? ("") : ("Jogando")));
                if(!sucess) sucess = true;
            }
        }
    }
    if(sucess) ShowPlayerDialog(playerid, 1010, DIALOG_STYLE_LIST, "Administradores Online",string,"Confirmar","Cancelar");
    else SendClientMessage(playerid, 0xFF0000FF,"Erro: Nenhum administrador estб online.");
    return true;
}
PS:Nгo testado.
Reply
#9

PHP код:
C:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(6398) : warning 215expression has no effect
C
:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(83602) : error 002only a single statement (or expressioncan follow each "case"
C:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(83602) : warning 215expression has no effect
C
:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(83602) : error 001expected token";"but found "-identifier-"
C:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(83614) : error 002only a single statement (or expressioncan follow each "case"
C:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(83614) : warning 215expression has no effect
C
:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(83614) : error 001expected token";"but found "-identifier-"
C:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(83619) : error 010invalid function or declaration
C
:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(83621) : error 010invalid function or declaration
C
:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(83624) : error 010invalid function or declaration
C
:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(83628) : error 010invalid function or declaration
C
:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(83629) : error 010invalid function or declaration
C
:\Users\Narielson\Documents\Gamemode\AQUI\gamemodes\BPG.pwn(83630) : error 010invalid function or declaration
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase 
DEU ESSES ERROS
Reply
#10

Quote:

DEU ESSES ERROS

Acho que concertei, tente novamente.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)