Help with /admin command
#10

PHP Code:
if(adlvl[i] >= && UndercoverAdmin[i] == 0
This is just an example of how it should be, replace the UndercoverAdmin with your undercover admin variable it basically means if a player's adminlevel is above or equal to 6 AND if the player is NOT undercover admin. You may as well place it below IsPlayerConnected as an if statement and it should work. An example is;

PHP Code:
CMD:admins(playeridparams[])
{
    new 
playername[MAX_PLAYER_NAME];
    
    if(
GetPlayerScore(playerid) < 50) return SendClientMessage(playeridCOLOR_RED"You need 50 score to see online administrators");
    new 
count 0string[128], AdmRank[128];
    new 
ChangeColor;
    
SendClientMessage(playeridCOLOR_GREEN" ");
    
SendClientMessage(playeridCOLOR_GREEN"___________ |- Online Admins -| ___________");
    
SendClientMessage(playeridCOLOR_GREEN" ");
    for(new 
0MAX_PLAYERSi++) {
      if(
IsPlayerConnected(i))
       {
       if(
UndercoverAdmin[i] == 0)
       {
          if (
adlvl[i] >= 1)
          {
            
GetPlayerName(iplayernameMAX_PLAYER_NAME);
            if(
adlvl[i] >= 6)
            {
                
AdmRank "Server Owner/Developer";
                
ChangeColor COL_LEVEL4;
            }
            else
            {
                switch(
adlvl[i])
                {
                    case 
1: {
                    
AdmRank "Moderator";
                    
ChangeColor COL_LEVEL1;
                    }
                    case 
2: {
                    
AdmRank "Senior Moderator";
                    
ChangeColor COL_LEVEL2;
                    }
                    case 
3: {
                    
AdmRank "Administrator";
                    
ChangeColor COL_LEVEL3;
                    }
                    case 
4: {
                    
AdmRank "Lead Administrator";
                    
ChangeColor COL_LEVEL4;
                    }
                    case 
5: {
                    
AdmRank "Lead Administrator";
                    
ChangeColor COL_LEVEL4;
                    }
                }
            }
        }
        
format(string128"%s | %s"playernameAdmRank);
        
SendClientMessage(playeridChangeColorstring);
        
count ++;
      }
         }
    }
    if(
count == 0)
    
SendClientMessage(playeridADMINSONLINE"There are currently no administrators online.");
    return 
1;

Edit: Sorry about the indentation, I messed up a bit. Again, don't forget to change the undercoveradmin variable to fit your needs.

Edit 2: Also make sure to change the ChangeColor variable to a local variable. As a global variable, it will change per individual, meaning the last admin who gets counted will be the deciding factor of the colour displayed. What you need to do is basically this;

PHP Code:
new ChangeColor[MAX_PLAYERS]; 
instead of

PHP Code:
new ChangeColor
and change each ChangeColor to

PHP Code:
ChangeColor(i
Reply


Messages In This Thread
Help with /admin command - by Tass007 - 03.02.2016, 09:43
Re: Help with /admin command - by jlalt - 03.02.2016, 09:56
Re: Help with /admin command - by KillerDVX - 03.02.2016, 09:58
Re: Help with /admin command - by Tass007 - 03.02.2016, 10:11
Re: Help with /admin command - by jlalt - 03.02.2016, 10:19
Re: Help with /admin command - by Sew_Sumi - 03.02.2016, 11:47
Re: Help with /admin command - by Tass007 - 03.02.2016, 18:46
Re: Help with /admin command - by povargek - 03.02.2016, 19:02
Re: Help with /admin command - by Tass007 - 03.02.2016, 19:30
Re: Help with /admin command - by Rufio - 03.02.2016, 19:46

Forum Jump:


Users browsing this thread: 1 Guest(s)