Admin chat
#1

Hi all!

Basically, I am having problems getting a proper admin chat system.
As of now, I have 4 admin levels, which is already scripted in for me.
Using PAWN.

I have been searching for about the last half-hour or so, and couldn't find anything.

The thing I am interested in is:
- Need to be between admins only, 1-4.
- Need to be in a specific colour.
- Need to be able to see the admin level of the specific admin talking in the admin chat.
- Easy command like /a

If anyone could help me out, that would have been greatly appreciated, thanks!
Reply
#2

Since you didn't described which cmd processor you are using, i will make one using zcmd:
pawn Код:
CMD:a(playerid, params[])
{
    if(PlayerInfo[playerid][Level] >= 1) // Change to the way you check admin level
    {
        new
            iStr[128],
            iName[MAX_PLAYER_NAME];

        if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /A < Text >");

        GetPlayerName(playerid, iName, sizeof(iName));

        for(new i = 0; i < MAX_PLAYERS; ++i) // I recommend using foreach: foreach(Player, i)
        {
            if(IsPlayerConnected(i) && !IsPlayerNPC(i) && PlayerInfo[i][Level] >= 1) // Change to the way you check admin level
            {
                format(iStr, sizeof(iStr), "[ADMIN CHAT] - %s: %s", iName, params);
                SendClientMessage(i, COLOR_HERE, iStr);
             }
        }
    }
    return 1;
}
Reply
#3

pawn Код:
COMMAND:ac(playerid,params[])
        {
            if (IsPlayerAdmin(playerid))
            {
            new name[MAX_PLAYER_NAME], mess[128],text;
            if (isnull(params)) return SendClientMessage(playerid,"Usage: /ac [your text here]");
                        sscanf(params,"s",mess);
            GetPlayerName(playerid,name,sizeof(name));
            new lvl;
            switch(PlayerInfo[playerid][Level])
            {
            case 1 {lvl = 1;}
            case 2 {lvl = 2;}
            case 3 {lvl = 3;}
            case 4 {lvl = 4;}
                        }
                for(new i = 0; i < MAX_PLAYERS; ++i)
                {
                    if (IsConnected(i) && !IsPlayerNPC(i) && PlayerInfo[i][Level] >= 1)
                    {
                        format(text,sizeof(text),"[Admin Chat]%s[%s]: %s",name,lvl,mess);
                        SendClientMessage(i,COLOR_LIGHTBLUE,text);
                    }
                }
            } else { SendClientMessage(playerid,red,"You are not an admin."); }
        }
Extended with specified level and no-admin message
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)