SA-MP Forums Archive
/admins online - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /admins online (/showthread.php?tid=434623)



/admins online - kalanerik99 - 03.05.2013

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



Re: /admins online - BigGroter - 03.05.2013

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.


Re: /admins online - SimpalK - 03.05.2013

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;
}



Re: /admins online - BigGroter - 03.05.2013

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.


Re: /admins online - Yashas - 03.05.2013

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
                }
        }
}