/admins command need help with
#1

hey guys i would liek to get help with this if im a admin but it dosent show my name only some .". or somethin pls help look.

SS:http://imgur.com/a/BhXFX

Code:
Code:
    if(strcmp(cmdtext, "/admins", true) == 0)
	{
    
    SendClientMessage(playerid, 0x1FFFFFF, "Administrators online:");
    {
        new level[128], string[128];

        if(PlayerInfo[playerid][pAdminLevel] >= 0)
        {
            switch(PlayerInfo[playerid][pAdminLevel])
            {
            case 1: level = ""adminlevel1" (1)";
            case 2: level = ""adminlevel2" (2)";
            case 3: level = ""adminlevel3" (3)";
            case 4: level = ""adminlevel4" (4)";
            case 5: level = ""adminlevel1338" (1338)";
            case 6: level = ""adminlevel1999" (1999)";
            case 7: level = ""adminlevel2000" (2000)";
            case 8: level = ""adminlevel2013" (2013)";
            case 9: level = ""adminlevel2014" (2014)";
            }
            format(string, sizeof(string), "%s", level, GetPlayerName(pName) );
            SendClientMessage(playerid, 0xFFF84FFFF, string);
        }
    }
    return 1;
	}
Reply
#2

You should try this:
ZCMD:
Code:
CMD:admins(playerid, params[])
{
    SendClientMessage(playerid, 0x1FFFFFF, "Administrators online:");
    {
        new level[128], string[128];

        if(PlayerInfo[playerid][pAdminLevel] >= 0)
        {
            switch(PlayerInfo[playerid][pAdminLevel])
            {
            case 1: level = ""adminlevel1" (1)";
            case 2: level = ""adminlevel2" (2)";
            case 3: level = ""adminlevel3" (3)";
            case 4: level = ""adminlevel4" (4)";
            case 5: level = ""adminlevel1338" (1338)";
            case 6: level = ""adminlevel1999" (1999)";
            case 7: level = ""adminlevel2000" (2000)";
            case 8: level = ""adminlevel2013" (2013)";
            case 9: level = ""adminlevel2014" (2014)";
            }
            format(string, sizeof(string), "%d - %s", level, GetPlayerName(pName) );
            SendClientMessage(playerid, 0xFFF84FFFF, string);
        }
    }
    return 1;
	}
Didn't tested it yet
Reply
#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
#4

Awesome! TYVM it worked youre awesome :P
Reply
#5

No problem dude Glad I could resolve your problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)