[Ayuda]Con mi comando /admins
#1

pawn Код:
dcmd_admins(playerid,params[]) {
    #pragma unused params
    new Count[2], i, string[128];
    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
    {
        if(PlayerInfo[i][Level] > 0 && PlayerInfo[i][Hide] == 0) Count[0]++;
        if(IsPlayerAdmin(i)) Count[1]++;
    }


    if( (Count[0] == 0 && Count[1] == 0) || (Count[0] == 0 && Count[1] >= 1 && PlayerInfo[playerid][Level] == 0) )
    {
        ShowPlayerDialog(playerid,4554,DIALOG_STYLE_MSGBOX,"Admins Espaсol Mega Mania FreeroaM..","No hay Admins Online","Aceptar","");
       
        return 1;
    }
    if(Count[0] == 1)
    {
        for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 0 && PlayerInfo[i][Hide] == 0)
        {
            format(string, sizeof(string), "{FFFFFF}Admin Online: \n\n(ID %d)%s [lvl %d]", i, PlayerName2(i), PlayerInfo[i][Level] );
            ShowPlayerDialog(playerid,4554,DIALOG_STYLE_MSGBOX,"Admins Espaсol Mega Mania FreeroaM..",string,"Aceptar","");
            }
    }

    if(Count[0] > 1)
    {
        new x; format(string, sizeof(string), "Admins Online:\n\n");
        for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 0 && PlayerInfo[i][Hide] == 0)
        {
            format(string,sizeof(string),"{339900}%s{FFFFFF}(%d){FF0000}%s{339900} [%d]",string,i,PlayerName2(i),PlayerInfo[i][Level]);
            x++;
            if(x >= 5)
            {
                ShowPlayerDialog(playerid,4554,DIALOG_STYLE_MSGBOX,"Admins Espaсol Mega Mania FreeroaM..",string,"Aceptar","");
                format(string, sizeof(string), "Admins:"); x = 0;
            }
            else format(string, sizeof(string), "%s\n", string);
        }
        if(x <= 4 && x > 0)
        {
            ShowPlayerDialog(playerid,4564,DIALOG_STYLE_MSGBOX,"Admins Espaсol Mega Mania FreeroaM..",string,"Aceptar","");
        }
    }

    if( (Count[1] == 1) && (PlayerInfo[playerid][Level] > 0 && PlayerInfo[i][Hide] == 0) ) {
        for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i) && PlayerInfo[i][Hide] == 0) {
            format(string, sizeof(string), "RCON Admin: (%d)%s", i, PlayerName2(i)); SendClientMessage(playerid, COLOR_WHITE, string);
        }
    }
    if(Count[1] > 1)
    {
        new x; format(string, sizeof(string), "RCON Admins: ");
        for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i) && PlayerInfo[i][Hide] == 0)
        {
            format(string,sizeof(string),"%s(%d)%s",string,i,PlayerName2(i));
            x++;
            if(x >= 5) {
                SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "RCON Admins: "); x = 0;
            }
            else format(string, sizeof(string), "%s,  ", string);
        }
        if(x <= 4 && x > 0) {
            string[strlen(string)-3] = '.';

            SendClientMessage(playerid, COLOR_WHITE, string);
        }
    }
    return 1;
}
bueno el comando no tienen ningun bug

solo queria saber si alguien me podria explicar que puedo hacer para que cuando ponga /admins

me diga..

Adminstradores conectados
-x
-x
-x

hay en total 3 admins conectados <<<< Esto

que cuente en numeros cuantos admins hay conectados


les agradeceria mucho si me ayudasen
gracias.
Reply
#2

una variable que almacene
por ejemplo adminsonline
pones adminsonline++; en cada lugar donde muestra un admin(donde los aсade a la string)
y luego pones un format que diga hay en total %d admins conectados y luego le metes la variable esa, si, lo se no me explico muy bien
Reply
#3

y en donde pondria el AdminstradoresConectados++; ??
Reply
#4

Muy buena idea loco... me gustaria que me pasen el script porfa amigos
Reply
#5

Hechale un vistazo al comando /admins de LARP, a ver si te haces una idea de como puedes transfromarlo a tu sistema de administraciуn.
Reply
#6

aun no consigo que cuente los admins porfa que algien me de ayuda
Reply
#7

A ver, intentarй hacer yo el comando:

pawn Код:
dcmd_admins(playerid, params[])
{
    new
        szTitle[32],
        szString[256],
        szName[24],
        iRconAdmins,
        iAdmins,
        iPos,
        iMax;

    iMax = GetMaxPlayers();
    for ( ; iPos < iMax; iPos ++)
        if (IsPlayerConnected(iPos))
            if (IsPlayerAdmin(iPos))
            {
                GetPlayerName(iPos, szName, sizeof (szName));
                format(szString, sizeof (szString), "%s- %s [%i] - RCON\n", szString, szName, iPos);
                iRconAdmins ++;
            }
            else if ((PlayerInfo[iPos][Level] > 0) && (!PlayerInfo[iPos][Hide]))
            {
                GetPlayerName(iPos, szName, sizeof (szName));
                format(szString, sizeof (szString), "%s- %s [%i] - LEVEL %i\n", szString, szName, iPos, PlayerInfo[iPos][Level]);
                iAdmins ++;
            }

    if ((!iRconAdmins) && (!iAdmins))
    {
        ShowPlayerDialog(playerid, DIALOG_ID_ACA, DIALOG_STYLE_MSGBOX, "Admins", "No hay admins online.", "OK", " ");
        return 1;
    }

    format(szTitle, sizeof (szTitle), "RCON Admins: %i - Admins: %i", iRconAdmins, iAdmins);
    ShowPlayerDialog(playerid, DIALOG_ID_ACA, DIALOG_STYLE_MSGBOX, szTitle, szString, "OK", " ");
    return 1;
}

Supongo que deberнa funcionar.
Reply
#8

Muchas gracias MrDeath eres lo mejor
Reply
#9

Quote:
Originally Posted by WHEELMANDTS
Посмотреть сообщение
Muchas gracias MrDeath eres lo mejor
De nada
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)