SA-MP Forums Archive
command to hide admin prefix - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: command to hide admin prefix (/showthread.php?tid=568537)



command to hide admin prefix - pitchooo - 23.03.2015

Hello,

I added admin prefix to the names of admins with this code


Код:
OnPlayerText

if(PlayerInfo[playerid][pAdmin] == 1)
{

         new pname[MAX_PLAYER_NAME], string2[560 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));

            format(string2, sizeof(string2), "[Admin] %s: %s", pname, text);
    SendClientMessageToAll(COLOR_WHITE, string2);
How can I do so that a command can hide this prefix?


Re: command to hide admin prefix - Nabster - 23.03.2015

I use ZCMD

Код:
new HidePrefix[MAX_PLAYERS];

CMD:hide(playerid,params[])
{
        HidePrefix[playerid] = 1;
 	return 1;
}

public OnPlayerText(playerid,text[])
{
      if(PlayerInfo[playerid][pAdmin] == 1 && HidePrefix[playerid] == 0)
     {

        new pname[MAX_PLAYER_NAME], string2[560 + MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, sizeof(pname));
        format(string2, sizeof(string2), "[Admin] %s: %s", pname, text);
        SendClientMessageToAll(COLOR_WHITE, string2);
     }
}
if prefix = 1 then use your noraml message


Re: command to hide admin prefix - SickAttack - 23.03.2015

Example:
pawn Код:
new bool:pUndercover[MAX_PLAYERS] = false;

public OnPlayerText(playerid, text[])
{
    new string[256], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));

    if(PlayerInfo[playerid][pAdmin] == 1)
    {
        if(pUndercover[playerid] == true)
        {
            format(string, sizeof(string), "[Admin] %s: %s", name, text);
            SendClientMessageToAll(COLOR_WHITE, string);
        }
        else
        {
            format(string, sizeof(string), "%s: %s", name, text);
            SendClientMessageToAll(COLOR_WHITE, string);
        }
    }
    else
    {
        format(string, sizeof(string), "%s: %s", name, text);
        SendClientMessageToAll(COLOR_WHITE, string);
    }
    return 1;
}

CMD:hide(playerid, params[])
{
    if(pUndercover[playerid] == true) return SendClientMessage(playerid, -1, "You are already hidden!");
    pUndercover[playerid] = true;
}

CMD:unhide(playerid, params[])
{
    if(pUndercover[playerid] == false) return SendClientMessage(playerid, -1, "You aren't hidden!");
    pUndercover[playerid] = false;
}



Re: command to hide admin prefix - pitchooo - 24.03.2015

Thank You.