Admin Chat
#1

Hi, I would like to make an admin chat.

For example:
Код:
@[TDM]Puzi: Yo
...and so it is in white

Please help as I can't make my own code. Tried once but I messed all up

Thanks and Regards
Puzi
Reply
#2

how do you mean i got 2 codes for you
one is only admin ( noly admin can see it )
if you copy on of this commands
here are the color's

pawn Код:
#define COLOR_PURPLE 0x58f205ff
#define COLOR_BLUE 0x00dbffff
pawn Код:
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[64];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmdtext[idx];
            idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result))
        {
            SendClientMessage(playerid, COLOR_BLUE, "USAGE: (/a)dmin [admin chat]");
            return 1;
        }
        format(string, sizeof(string), "*Admin %s:[%d] %s", sendername, playerid, result);
        if (PlayerInfo[playerid][pAdmin] > 100)
        {
            SendAdminMessage(COLOR_BLUE, string);
        }
        printf("Admin %s:[%d] %s", sendername, playerid, result);
        return 1;
    }
everybody can see this

pawn Код:
if(strcmp(cmd, "/amess", true) == 0 && IsPlayerConnected(playerid) || strcmp(cmd, "/am", true) == 0 && IsPlayerConnected(playerid))
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[64];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmdtext[idx];
            idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result))
        {
            SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /am [message]");
            return 1;
        }
        if (PlayerInfo[playerid][pAdmin] >= 102)
        {
      format(string, sizeof(string), "** Admin %s:[%d] %s **", sendername, playerid, result);
            SendClientMessageToAll(COLOR_BLUE, string);
            printf("** Admin: %s:[%d] %s **", sendername, playerid, result);
        }
        else
        {
            SendClientMessage(playerid, COLOR_PURPLE, " You are Not Authorized to use that command.");
            return 1;
        }
    }
Reply
#3

A version


Quote:

Example (Write chat..):

Adminchat id 5 cheater, ban?

B version


Quote:

Example (Write chat..):

@ id 5 cheater, ban?

Reply
#4

Thanks Guys. Its working
Reply
#5

Sorry! Color is yellow... White Code: 0xF6F6F6AA
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)