/admins command need help with
#3

Your methods will not work anyways, you're only showing if the player typing the command is the admin.

This code, loops through the players to check that he/she is admin, if so it'll display them to the user. I've used some stock functions to display the rank and the name, just to save space:

pawn Code:
CMD:admins(playerid, params[])
{
    new count = 0, string[164];
    SendClientMessage(playerid, -1, "Admins Online");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {  
        if(PlayerInfo[i][pAdminLevel] >= 1)
        {
            format(string, sizeof(string), "%s %s (ID: %d)", AdminRankName(i), getName(i), i);
            SendClientMessage(playerid, -1, string);
            count++;
        }
    }
    if(count == 0)
    {
        SendClientMessage(playerid, -1, "There are no administrators online.");
    }
}

stock AdminRankName(playerid)
{
    new astring[28];   
    switch(PlayerInfo[playerid][pAdminLevel])
    {
            case 1: format(astring, sizeof(astring), "Admin Level 1");
            case 2: format(astring, sizeof(astring), "Admin Level 2");
            case 3: format(astring, sizeof(astring), "Admin Level 3");
            case 4: format(astring, sizeof(astring), "Admin Level 4");
            case 5: format(astring, sizeof(astring), "Admin Level 1338");
            case 6: format(astring, sizeof(astring), "Admin Level 1999");
            case 7: format(astring, sizeof(astring), "Admin Level 2000");
            case 8: format(astring, sizeof(astring), "Admin Level 2013");
            case 9: format(astring, sizeof(astring), "Admin Level 2014");
    }
    return astring;
}

stock getName(playerid)
{
    new a[MAX_PLAYER_NAME +1];
    GetPlayerName(playerid, a, sizeof(a));
    return a;
}
EDIT:

GetPlayerName(pName); - this is wrong. GetPlayerName has 3 parameters you must fill:

GetPlayerName(playerid, const name[], len);
Reply


Messages In This Thread
/admins command need help with - by Acres - 08.01.2014, 14:05
Re: /admins command need help with - by ViciousRoleplay123 - 08.01.2014, 14:44
Re: /admins command need help with - by sammp - 08.01.2014, 15:09
Re: /admins command need help with - by Acres - 08.01.2014, 16:24
Re: /admins command need help with - by sammp - 08.01.2014, 16:32

Forum Jump:


Users browsing this thread: 1 Guest(s)