/admins online
#1

Hi

Can some ne tell me how to make /admins command who will show you admins online and their id's and level in dialog msgbox
Reply
#2

pawn Код:
CMD:admins(playerid, params[])
{
    new name[MAX_PLAYER_NAME], string[128];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i))
        {
            GetPlayerName(i, name, sizeof(name));
            format(string, sizeof(string), "%s", name);
            ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, "Admins online", string, "OK","");
        }
    }
    return 1;
}
Try this, untested.
What admin system are you using? This only displays RCON admins.
Reply
#3

Here its :-
pawn Код:
CMD:admins(playerid,params[])
{
    new Count, string[128],n[MAX_PLAYER_NAME];
    SendClientMessage(playerid, COLOR_BLUE, "__________|Admins|__________");
    foreach(Player, i)
    {
        if(pInfo[i][Adminlevel] >=1) {
            GetPlayerName(i,n,sizeof(n));
            format(string,sizeof(string),"     %s  ",n);
            SendClientMessage(playerid,COLOR_WHITE,string);
            Count++;
        }
    }
    if(Count == 0) SendClientMessage(playerid, COLOR_WHITE, "No Admin Online");
    SendClientMessage(playerid, COLOR_BLUE, "____________________________");
    return 1;
}
Reply
#4

Quote:
Originally Posted by SimpalK
Посмотреть сообщение
Here its :-
pawn Код:
CMD:admins(playerid,params[])
{
    new Count, string[128],n[MAX_PLAYER_NAME];
    SendClientMessage(playerid, COLOR_BLUE, "__________|Admins|__________");
    foreach(Player, i)
    {
        if(pInfo[i][Adminlevel] >=1) {
            GetPlayerName(i,n,sizeof(n));
            format(string,sizeof(string),"     %s  ",n);
            SendClientMessage(playerid,COLOR_WHITE,string);
            Count++;
        }
    }
    if(Count == 0) SendClientMessage(playerid, COLOR_WHITE, "No Admin Online");
    SendClientMessage(playerid, COLOR_BLUE, "____________________________");
    return 1;
}
No, that's obviously not it. Check his first post before you copy some random script.
Reply
#5

Quote:
Originally Posted by SimpalK
Посмотреть сообщение
Here its :-
pawn Код:
CMD:admins(playerid,params[])
{
    new Count, string[128],n[MAX_PLAYER_NAME];
    SendClientMessage(playerid, COLOR_BLUE, "__________|Admins|__________");
    foreach(Player, i)
    {
        if(pInfo[i][Adminlevel] >=1) {
            GetPlayerName(i,n,sizeof(n));
            format(string,sizeof(string),"     %s  ",n);
            SendClientMessage(playerid,COLOR_WHITE,string);
            Count++;
        }
    }
    if(Count == 0) SendClientMessage(playerid, COLOR_WHITE, "No Admin Online");
    SendClientMessage(playerid, COLOR_BLUE, "____________________________");
    return 1;
}
What gaurntee you have that he uses this particular admin system and those variables??
Don't blindly copy code and paste it!!!

Just make a loop which checks all players.Inside the loop block add first if that would check if the player is connected and second if that will check the admin level.You have a variable or use IsPlayerAdmin native.

Код:
for(new i =0;i < MAX_PLAYERS;i++)
{
         if(IsPlayerConnected(i))//Checks if the player is connected
        {
                 if(IsPlayerAdmin(i))//Check if the player is admin
                {
                        //IF THE EXECUTION REACHES HERE< THE PLAYER WITH ID 'i' IS AN ADMIN - Add your stuff here to display or ,etc
                }
        }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)