SA-MP Forums Archive
/admins command - 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 command (/showthread.php?tid=369146)



/admins command - CROSS_Hunter - 15.08.2012

i want to make a /admins command so it displays all online admins in a dialog? any help?


Re : /admins command - Naruto_Emilio - 16.08.2012

next time use search

https://sampforum.blast.hk/showthread.php?tid=162971


Re: /admins command - ThePhenix - 16.08.2012

Example!

pawn Code:
dcmd_admins(playerid,params[])
{
    #pragma unused params
        new count = 0;
        new string[128];
        new ChangeColor;
        SendClientMessage(playerid, white, " ");
        SendClientMessage(playerid, white, "Admins Online");
        SendClientMessage(playerid, white, " ");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if (IsPlayerConnected(i))
            {
                if(AccInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
                {
                    if(AccInfo[i][Level] > 5)
                    {
                        AdmRank = "Level 7";
                        ChangeColor = Color_Level_7;
                    }
                    if(IsPlayerAdmin(i))
                    {
                        AdmRank = "RCON Administrator";
                        ChangeColor = Color_RCON_Administrator;
                    }
                    else
                    {
                        switch(AccInfo[i][Level])
                        {
                            case 1: {
                            AdmRank = "Level1";
                            ChangeColor = Color_Level_1;
                            case 2: {
                            AdmRank = "Level2";
                            ChangeColor = Color_Level_2;
                            }
                            case 3: {
                            AdmRank = "Level3";
                            ChangeColor = Color_Level_3;
                            }
                            case 4: {
                            AdmRank = "Level4 ";
                            ChangeColor = Color_Level_4;
                            }
                            case 5: {
                            AdmRank = "Level5";
                            ChangeColor = Color_Level_5;
                            }
                        }
                    }
                    switch(AccInfo[i][OnDuty])
                    {
                        case 0: AdmDuty = "Playing!";
                        case 1: AdmDuty = "On Duty!";
                    }
                    format(string, 128, "Level: %d - %s (Id:%i) | %s | %s",AccInfo[i][Level], PlayerName2(i),i,AdmRank,AdmDuty);
                    SendClientMessage(playerid, ChangeColor, string);
                    count++;
                }
            }
        }
        if (count == 0)
        SendClientMessage(playerid,white,"No admin online in the list");
        return 1;
}
This is an example, It won't work because missing the defines.

But you can gather them and make it work!


Re: /admins command - CROSS_Hunter - 16.08.2012

Quote:
Originally Posted by ThePhenix
View Post
Example!

pawn Code:
dcmd_admins(playerid,params[])
{
    #pragma unused params
        new count = 0;
        new string[128];
        new ChangeColor;
        SendClientMessage(playerid, white, " ");
        SendClientMessage(playerid, white, "Admins Online");
        SendClientMessage(playerid, white, " ");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if (IsPlayerConnected(i))
            {
                if(AccInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
                {
                    if(AccInfo[i][Level] > 5)
                    {
                        AdmRank = "Level 7";
                        ChangeColor = Color_Level_7;
                    }
                    if(IsPlayerAdmin(i))
                    {
                        AdmRank = "RCON Administrator";
                        ChangeColor = Color_RCON_Administrator;
                    }
                    else
                    {
                        switch(AccInfo[i][Level])
                        {
                            case 1: {
                            AdmRank = "Level1";
                            ChangeColor = Color_Level_1;
                            case 2: {
                            AdmRank = "Level2";
                            ChangeColor = Color_Level_2;
                            }
                            case 3: {
                            AdmRank = "Level3";
                            ChangeColor = Color_Level_3;
                            }
                            case 4: {
                            AdmRank = "Level4 ";
                            ChangeColor = Color_Level_4;
                            }
                            case 5: {
                            AdmRank = "Level5";
                            ChangeColor = Color_Level_5;
                            }
                        }
                    }
                    switch(AccInfo[i][OnDuty])
                    {
                        case 0: AdmDuty = "Playing!";
                        case 1: AdmDuty = "On Duty!";
                    }
                    format(string, 128, "Level: %d - %s (Id:%i) | %s | %s",AccInfo[i][Level], PlayerName2(i),i,AdmRank,AdmDuty);
                    SendClientMessage(playerid, ChangeColor, string);
                    count++;
                }
            }
        }
        if (count == 0)
        SendClientMessage(playerid,white,"No admin online in the list");
        return 1;
}
This is an example, It won't work because missing the defines.

But you can gather them and make it work!
Copying from LuxAdmin?