Hide command problem
#1

How to make an Hide function or command for admins. so they will be hidden from admin list
PHP код:
if(strcmp(cmd"/admins"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
SendClientMessage(playeridCOLOR_WHITE"**Online Administrators**");
             
//foreach(Player, i)
               
for(new ii<MAX_PLAYERSi++)
            {
                   if(
IsPlayerConnected(i))
                {
                    if(
PInfo[i][AdminLevel] > 0)
                    {
                        new 
rank[128];
                        if(
PInfo[i][AdminLevel] == 1)
                        {
                            
format(ranksizeof(rank), "Junior Moderator");
                        }
                        else if(
PInfo[i][AdminLevel] == 2)
                        {
                            
format(ranksizeof(rank),"Moderator");
                        }
                        else if(
PInfo[i][AdminLevel] == 3)
                        {
                            
format(ranksizeof(rank),"Administrator");
                        }
                        else if(
PInfo[i][AdminLevel] == 4)
                        {
                            
format(ranksizeof(rank),"Head Administrator");
                        }
                        else if(
PInfo[i][AdminLevel] == 5)
                        {
                            
format(ranksizeof(rank),"Administrator");
                        }
                        else if(
PInfo[i][AdminLevel] == 6)
                        {
                            
format(ranksizeof(rank),"Server Owner");
                        }
                        
format(stringsizeof(string), "{FFFFFF}%s: {00FF00}%s(%d)",rankPlayerName(i), i);
                         
SendClientMessage(playeridCOLOR_GREENstring);
                    }
                }
            }
        }
        return 
1;
    } 
Reply
#2

Try It: /ahide /aunhide

search for bank, and add it under bank, Don't forget it>> ,<<
Код:
Hide,
Код:
CMD:ahide(playerid,params[]) {
    #pragma unused params
	if (PlayerInfo[playerid][Level] >= 4)
	{
	    if (PlayerInfo[playerid][Hide] == 1)
 		return SendClientMessage(playerid,red,"ERROR: you are already hidden in the admin list!");

 		PlayerInfo[playerid][Hide] = 1;
   		return SendClientMessage(playerid,green,"you are now hidden from the admin list");
	}
	return SendClientMessage(playerid,red,"you cant use this command, you need to be level 6");
}
CMD:aunhide(playerid,params[]) {
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 4)
	{
 		if (PlayerInfo[playerid][Hide] != 1)
 		return SendClientMessage(playerid,red,"ERROR: you are not hidden in the admin list!");
  		PlayerInfo[playerid][Hide] = 0;
   		return SendClientMessage(playerid,green,"you are now visible in the admin list");
	}
 	return SendClientMessage(playerid,red,"you cant use this command, you need to be level 6");
}
Reply if you got any problem !!!
+Rep
Reply
#3

I don't get it vikoo !
I think you forgot to add an 'else if' statement so the Admin who used /ahide doesn't appear in the /admins list, that's what I think bugmenotlol really wants to do !
So that's what you have to add into your /admins command + Vikoo's commands
Код:
                    if(PInfo[i][AdminLevel] > 0) 
                    { 
                        new rank[128]; 
                        if(PInfo[i][AdminLevel] == 1) 
                        { 
                            format(rank, sizeof(rank), "Junior Moderator"); 
                        } 
                    }
                    else if(PlayerInfo[i][Hide] != 1)  // Add this !
                        {
                           // return false 
                        }
//
Reply
#4

yea sorry i forgot must add it to /admins too you right miiSha
Reply
#5

Okey!

So, Here is what you have to do :

Код:
if(strcmp(cmd, "/admins", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_WHITE, "**Online Administrators**");
             //foreach(Player, i)
               for(new i; i<MAX_PLAYERS; i++)
            {
                   if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][Hide] == 0)  // Checks if you've typed in /ahide command
                    {
                    	if(PInfo[i][AdminLevel] > 0)
                    	{
                        	new rank[128];
                        	if(PInfo[i][AdminLevel] == 1)
                        	{
                            	format(rank, sizeof(rank), "Junior Moderator");
                        	}
                        	else if(PInfo[i][AdminLevel] == 2)
                        	{
                          	  format(rank, sizeof(rank),"Moderator");
                        	}
                        	else if(PInfo[i][AdminLevel] == 3)
                        	{
                            	format(rank, sizeof(rank),"Administrator");
                        	}
                        	else if(PInfo[i][AdminLevel] == 4)
                        	{
                            	format(rank, sizeof(rank),"Head Administrator");
                        	}
                        	else if(PInfo[i][AdminLevel] == 5)
                        	{
                            	format(rank, sizeof(rank),"Administrator");
                        	}
                        	else if(PInfo[i][AdminLevel] == 6)
                        	{
                            	format(rank, sizeof(rank),"Server Owner");
                        	}
                        	format(string, sizeof(string), "{FFFFFF}%s: {00FF00}%s(%d)",rank, PlayerName(i), i);
                         	SendClientMessage(playerid, COLOR_GREEN, string);
						}
 		     else if(PlayerInfo[i][Hide] == 1)
 		     {
 		     }
                }
            }
        }
        return 1;
    }
Then Add the Two Commands Vikooo has given you.
I made this code quickly, I didn't test it yet, PM me if you got any errors or something ^^
Reply
#6

Quote:
Originally Posted by MiiSha
Посмотреть сообщение
Okey!

So, Here is what you have to do :

Код:
if(strcmp(cmd, "/admins", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_WHITE, "**Online Administrators**");
             //foreach(Player, i)
               for(new i; i<MAX_PLAYERS; i++)
            {
                   if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][Hide] == 0)  // Checks if you've typed in /ahide command
                    {
                    	if(PInfo[i][AdminLevel] > 0)
                    	{
                        	new rank[128];
                        	if(PInfo[i][AdminLevel] == 1)
                        	{
                            	format(rank, sizeof(rank), "Junior Moderator");
                        	}
                        	else if(PInfo[i][AdminLevel] == 2)
                        	{
                          	  format(rank, sizeof(rank),"Moderator");
                        	}
                        	else if(PInfo[i][AdminLevel] == 3)
                        	{
                            	format(rank, sizeof(rank),"Administrator");
                        	}
                        	else if(PInfo[i][AdminLevel] == 4)
                        	{
                            	format(rank, sizeof(rank),"Head Administrator");
                        	}
                        	else if(PInfo[i][AdminLevel] == 5)
                        	{
                            	format(rank, sizeof(rank),"Administrator");
                        	}
                        	else if(PInfo[i][AdminLevel] == 6)
                        	{
                            	format(rank, sizeof(rank),"Server Owner");
                        	}
                        	format(string, sizeof(string), "{FFFFFF}%s: {00FF00}%s(%d)",rank, PlayerName(i), i);
                         	SendClientMessage(playerid, COLOR_GREEN, string);
						}
 		     else if(PlayerInfo[i][Hide] == 1)
 		     {
 		     }
                }
            }
        }
        return 1;
    }
Then Add the Two Commands Vikooo has given you.
I made this code quickly, I didn't test it yet, PM me if you got any errors or something ^^
Good but optimize your script

Using Switch

PHP код:
if(strcmp(cmd"/admins"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
SendClientMessage(playeridCOLOR_WHITE"**Online Administrators**");
            
//foreach(Player, i)
            
for(new ii<MAX_PLAYERSi++)
            {
                if(
IsPlayerConnected(i))
                {
                    if(
PlayerInfo[i][Hide] == 0)  // Checks if you've typed in /ahide command
                    
{
                        new 
name[128];
                        switch(
PInfo[i][AdminLevel])
                        {
                            case 
1name "Junior Moderator";
                            case 
2name "Moderator";
                            case 
3name "Administrator";
                            case 
4name "Head Administrator";
                            case 
5name "Administrator";
                            case 
6name "Server Owner";
                        }
                 
                    
format(stringsizeof(string), "{FFFFFF}%s: {00FF00}%s(%d)",namePlayerName(i), i);
                    
SendClientMessage(playeridCOLOR_GREENstring);
                }
              else if(
PlayerInfo[i][Hide] == 1)
              {
              }
                }
            }
        }
        return 
1;
    } 
Use a Proccessor command fast, and foreach
Reply
#7

thnx for helping
Reputed to all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)