command to hide admin prefix
#1

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?
Reply
#2

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
Reply
#3

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;
}
Reply
#4

Thank You.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)