/admins Command.
#3

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

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerName(i, n, sizeof(n));
            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;
}
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: 1 Guest(s)