Making an Admin's list
#8

Quote:
Originally Posted by introzen
Посмотреть сообщение
You're not sending any message if there's an admin online. Your just grabbing the variable and defining admtext. You need to format a string and send it oncertainly you've confirmed there's an administrator online.
Quote:
Originally Posted by Jamester
Посмотреть сообщение
PHP код:
cmd(adminsplayeridparams[])
{
    if(
IsPlayerConnected(playerid))
    {
        
SendClientMessage(playerid, -1"");
        
SendClientMessage(playeridCOLOR_ADMIN"Online Administrators:");
        for(new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i))
            {
                if(
GetPVarInt(playerid"AdminLevel") <= 1338)
                {
                    new 
admtext[64], sendername[MAX_PLAYER_NAME];
                    if(
GetPVarInt(playerid"AdminLevel") == 1337) { admtext "Head Administrator"; }
                    
GetPlayerName(isendernamesizeof(sendername));
                    new 
tstr[128];
                    
format(tstr128"%s (%s)"sendernameadmtext);
                    
SendClientMessage(playeridCOLOR_ADMINtstr);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_ADMIN"No online staff members currently found.");
                    return 
1;
                }
            }
        }
    }
    return 
1;

This has worked perfectly. Thank you for doing this. I take it I can just repeat the lines and it'll just print them if there's more than one Administrator online? Like the following:

Код:
cmd(admins, playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, -1, "");
        SendClientMessage(playerid, COLOR_ADMIN, "Online Staff Members:");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(GetPVarInt(playerid, "AdminLevel") <= 1338)
                {
                    new admtext[64], sendername[MAX_PLAYER_NAME];
                    if(GetPVarInt(playerid, "AdminLevel") == 1337) { admtext = "Head Administrator"; }
                    if(GetPVarInt(playerid, "AdminLevel") == 4) { admtext = "Senior Administrator"; }
                    if(GetPVarInt(playerid, "AdminLevel") == 3) { admtext = "Administrator"; }
                    if(GetPVarInt(playerid, "AdminLevel") == 2) { admtext = "Moderator"; }
                    if(GetPVarInt(playerid, "AdminLevel") == 1) { admtext = "Moderator"; }
                    GetPlayerName(i, sendername, sizeof(sendername));
                    new tstr[128];
                    format(tstr, 128, "%s {FFFFFF}- %s", sendername, admtext);
                    SendClientMessage(playerid, COLOR_ADMIN, tstr);
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_ADMIN, "No online staff members currently found.");
                    return 1;
                }
            }
        }
    }
    return 1;
}
Hopefully this will work just fine, as I have more than just one Administrator for the server.
Thanks again, everyone who has assisted with the problem.
Reply


Messages In This Thread
Making an Admin's list - by Skillzz - 27.04.2016, 11:50
Re: Making an Admin's list - by Mark_Samp - 27.04.2016, 12:27
Re: Making an Admin's list - by Skillzz - 27.04.2016, 15:29
Re: Making an Admin's list - by introzen - 27.04.2016, 15:46
Re: Making an Admin's list - by Ritzy2K - 27.04.2016, 15:50
Re: Making an Admin's list - by J0sh... - 27.04.2016, 15:54
Re: Making an Admin's list - by Lumanov - 27.04.2016, 16:13
Re: Making an Admin's list - by Skillzz - 27.04.2016, 16:36
Re: Making an Admin's list - by J0sh... - 27.04.2016, 17:00
Re: Making an Admin's list - by Skillzz - 27.04.2016, 17:06

Forum Jump:


Users browsing this thread: 1 Guest(s)