How can I create the /secretadmin cmd
#1

I want to create a command for Admins like /secretadmin to hide your name out of /admins list, so no one can see you in /admin list..

I will appreciate your help,
thanks.

Код:
	if(strcmp(cmd, "/admins", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	if(PlayerInfo[playerid][pAdmin] >= 0)
	    	{
	    	    SendClientMessage(playerid, COLOR_WHITE, "Admins Online:");
	    	    //foreach(Player, i)
                for(new i; i<MAX_PLAYERS; i++)
				{
				    if(IsPlayerConnected(i))
				    {
						if(PlayerInfo[i][pAdmin] > 0)
						{
					    	GetPlayerName(i, giveplayer, sizeof(giveplayer));
							format(string, sizeof(string), "%d Admin: %s",PlayerInfo[i][pAdmin],giveplayer);
			            	SendClientMessage(playerid, COLOR_GREY, string);
						}
					}
				}
	    	}
		}
	    return 1;
	}
Reply
#2

PHP код:
//top of script
new bool:Hidden[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
Hidden[playerid] = false;
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (!
strcmp("/hide"cmdtexttrue))
    {
        if(
PlayerInfo[playerid][pAdmin] > 0)
        {
            switch(
Hidden[playerid])
            {
                case 
true:
                {
                    
Hidden[playerid] = false;
                    
SendClientMessage(playerid,0xFFFFFFFF,"You are now not showing in admins list!");
                }
                case 
false:
                {
                    
Hidden[playerid] = true;
                    
SendClientMessage(playerid,0xFFFFFFFF,"You are now showing in admins list!");
                }
            }
            return 
1;
        }
        else 
SendClientMessage(playerid,0xFF0000FF,"You can't use this command");
        return 
1;
    }
    if(!
strcmp(cmdtext"/admins"true))
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pAdmin] >= 0)
            {
                
SendClientMessage(playeridCOLOR_WHITE"Admins Online:");
                
//foreach(Player, i)
                
for(new ii<MAX_PLAYERSi++)
                {
                    if(
IsPlayerConnected(i))
                    {
                        if(
PlayerInfo[i][pAdmin] > 0)
                        {
                            if(
Hidden[i] = false)
                            {
                                
GetPlayerName(igiveplayersizeof(giveplayer));
                                
format(stringsizeof(string), "%d Admin: %s",PlayerInfo[i][pAdmin],giveplayer);
                                
SendClientMessage(playeridCOLOR_GREYstring);
                            }
                        }
                    }
                }
            }
        }
        return 
1;
    }
    return 
0;

NOTE: UNTESTED!

EDIT: JUST REPLACE MY /HIDE COMMAND WITH YOURS
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)