/admins Command.
#8

Quote:
Originally Posted by iZN
View Post
There were mistakes with playerid, the loop's variable 'i' should be the playerid, not variable 'id'. Your variable 'id' would only show player ID 0 since the default variable value is 0. You CAN use playerid parameter. I also did some changes with admin level checks, switch() statement is better than using many if-else statements. String size doesn't needs to be 256, I've lowered it to 128, and I'm sure that's even higher too.

pawn Code:
CMD:admins(playerid, params[])
{
    new n[MAX_PLAYER_NAME+1];
    new count = 0, string19[128];
    GetPlayerName(playerid, n, sizeof(n));

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            switch(pInfo[i][Adminlevel])
            {
                case 1:
                {
                    format(string19, sizeof(string19), "Trial Moderator : %s (%i)", n , i);
                    count++;
                }
                case 2:
                {
                    format(string19, sizeof(string19), "Moderator : %s (%i)", n , i);
                    count++;
                }
                case 3:
                {
                    format(string19, sizeof(string19), "Admin : %s (%i)", n , i);
                    count++;
                }
                case 4:
                {
                    format(string19, sizeof(string19), "Server Manager : %s (%i)", n , i);
                    count++;
                }
                case 5:
                {
                    format(string19, sizeof(string19), "Server Owner : %s (%i)", n , i);
                    count++;
                }
            }
        }
    }
    if(!count)
    {
        SendClientMessage(playerid, COLOR_GREEN, "");
        SendClientMessage(playerid, COLOR_GREEN, "|======== Online Admins =======|");
        SendClientMessage(playerid, COLOR_WHITE, "- No Admins Online at Time!");
        SendClientMessage(playerid, COLOR_GREEN, "|==============================|");
        SendClientMessage(playerid, COLOR_GREEN, "");
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREEN, "");
        SendClientMessage(playerid, COLOR_GREEN, "|======== Online Admins =======|");
        SendClientMessage(playerid, COLOR_WHITE, string19);
        SendClientMessage(playerid, COLOR_GREEN, "|==============================|");
        SendClientMessage(playerid, COLOR_GREEN, "");
    }
    return true;
}
Thanks For Editing , But Only Show 1 Admin Name Again , And If Player(He Isn't Admin) Type /admins , He Name Will In The Admin List , But He Isn't Admin , Is This A Bug Or? I Want That /admins We Can See More Admins Online , No Only 1. If You Understand Me , Thanks.

Quote:
Originally Posted by CalvinC
View Post
You should format and SendClientMessage for every admin, like:
pawn Code:
if(pInfo[id][Adminlevel] == 5)
{
    format(string19, sizeof(string19), "Server Owner : %s (%i)",n ,playerid);
    SendClientMessage(playerid, COLOR_WHITE, string19);
    count++;
}
And same with the rest.
Yes , I Tried But No Working , Same Problem Like iZN's Replied. The Problem Is : You're Not Admin But You Name Still In The Admin List. Thanks For You Replied Too. I Just Want That /admins Can Show More Admins Online , And Non-Admin Player's Name No On The Admin List Too.

Sorry About My Bad English.
Reply


Messages In This Thread
/admins Command. - by TuSheng - 20.03.2015, 10:20
Re: .:[Help]:. /admins Command. - by CalvinC - 20.03.2015, 10:22
Re: .:[Help]:. /admins Command. - by iZN - 20.03.2015, 10:42
Re: /admins Command. - by FOTIS6 - 20.03.2015, 12:00
Re: /admins Command. - by IzadorO - 20.03.2015, 12:03
Re: /admins Command. - by fuckingcruse - 20.03.2015, 12:07
Re: /admins Command. - by Glossy42O - 20.03.2015, 12:14
Re: .:[Help]:. /admins Command. - by TuSheng - 20.03.2015, 12:22
Re: .:[Help]:. /admins Command. - by iZN - 20.03.2015, 12:40
Re: .:[Help]:. /admins Command. - by CalvinC - 20.03.2015, 13:09

Forum Jump:


Users browsing this thread: 2 Guest(s)