Ayuda Bug en /Admins
#1

Ola tengo este comando para sadmin 2.0

pawn Код:
dcmd_admins(playerid,params[])
{
    #pragma unused params
    new Count,i,name[24],string[256], id;
    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Nivel] >= 3) Count++;
    if(!Count) return SendClientMessage(playerid, Rojo, "No hay Administradores conectados..");

    if(Count == 1)
    {
        for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Nivel] >= 3) break;
        GetPlayerName(i,name,24); format(string,256,"[Admin] %s [Nivel: %d][ID:%d]",name,PlayerInfo[i][Nivel],id);
        return SendClientMessage(playerid, Azul, string);
    }
    return 1;
}//Gracias a Cristian :P
Cuando hay un admin coenctado logeado todo bien pero cuando entra otro admin no sale xD
pongo /admins y no sale nada ): y cuando ay solo un admin sale su nick pero ay dos y no sale nada
como puedo arreglarlo?
Reply
#2

no tendria q ser if(Count > 1)
creo q como lo tenes vos es lo que hace q solo aparescan en la lista cuando solo hay uno
Reply
#3

Quote:
Originally Posted by ConecCionMex
Посмотреть сообщение
Ola tengo este comando para sadmin 2.0

pawn Код:
dcmd_admins(playerid,params[])
{
    #pragma unused params
    new Count,i,name[24],string[256], id;
    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Nivel] >= 3) Count++;
    if(!Count) return SendClientMessage(playerid, Rojo, "No hay Administradores conectados..");

    if(Count == 1)
    {
        for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Nivel] >= 3) break;
        GetPlayerName(i,name,24); format(string,256,"[Admin] %s [Nivel: %d][ID:%d]",name,PlayerInfo[i][Nivel],id);
        return SendClientMessage(playerid, Azul, string);
    }
    return 1;
}//Gracias a Cristian :P
Cuando hay un admin coenctado logeado todo bien pero cuando entra otro admin no sale xD
pongo /admins y no sale nada ): y cuando ay solo un admin sale su nick pero ay dos y no sale nada
como puedo arreglarlo?
jaja el que te hizo ese comando, o si lo hiciste vos se olvido/te olvidaste la otra parte del comando

fijate si asi te funciona:

pawn Код:
dcmd_admins(playerid,params[])
{
    #pragma unused params
    new Count, str[128], adminname[MAX_PLAYER_NAME];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && PlayerInfo[i][Nivel] >= 3){
            Count++;
        }
    }
    if(Count < 1) return SendClientMessage(playerid, COLOR_RED, "No hay Administradores conectados..");

    if(Count == 1){
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 0){
                GetPlayerName(i, adminname, sizeof(adminname));
                format(str, sizeof(str), "Admin: %s[%d][Level: %d]", adminname, i, PlayerInfo[i][Level]);
            }
        }
    }
   
    if(Count > 1)
    {
        new admins;
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 0)
            {
                format(str, sizeof(str), "Admins: ");
                GetPlayerName(i, adminname, sizeof(adminname));
                format(str, sizeof(str), "Admin: %s[%d][Level: %d]", adminname, i, PlayerInfo[i][Level]);
                admins++;
                if(admins < 5)
                {
                    SendClientMessage(playerid, COLOR_WHITE, str);
                    format(str, sizeof(str), "Admins: ");
                    admins = 0;
                }
                else format(str, sizeof(str), "%s,  ", str);
            }
        }
        if(admins < 5 && admins > 0)
        {
            str[strlen(str)-3] = '.';
            SendClientMessage(playerid, COLOR_WHITE, str);
        }
    }
    return 1;
}
Reply
#4

Quita el return antes de SendClientMessage, eso es todo.
Reply
#5

Quote:
Originally Posted by Infierno
Посмотреть сообщение
Quita el return antes de SendClientMessage, eso es todo.
aun asi el codigo que el posteo no funcionaria, ya que solo va a mostrar los admins conectados, cuando solo haya 1 admin conectado y no mas. ademas aun q no hiciera esto, mira que tiene un brake.
Reply
#6

Pruebo y te aviso :P
Reply
#7

Quote:
Originally Posted by the_chaoz
Посмотреть сообщение
aun asi el codigo que el posteo no funcionaria, ya que solo va a mostrar los admins conectados, cuando solo haya 1 admin conectado y no mas. ademas aun q no hiciera esto, mira que tiene un brake.
jaja sн es cierto.
Reply
#8

amm ahora ya ni me veo jaja
Ahora me conecto yo solo y no me veo ):
Reply
#9

aver... cambia:
pawn Код:
PlayerInfo[i][Nivel] >= 3)
por
pawn Код:
PlayerInfo[i][Nivel] > 1)
y abajo de:
pawn Код:
format(str, sizeof(str), "Admin: %s[%d][Level: %d]", adminname, i, PlayerInfo[i][Level]);
pone:
pawn Код:
SendClientMessage(playerid, COLOR_WHITE, str);
Reply
#10

Sige igual ):
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)