Admin Chat Command and Mute
#1

I need to know how to make an admin chat command from scratch, some codes
pawn Код:
enum pInfo
{
    pPass,
    pCash,
    pScore,
    pAdminLevel,
    pKills,
    pDeaths,
    pBanned
}
new PlayerInfo[MAX_PLAYERS][pInfo];

public OnPlayerCommandText(playerid, cmdtext[])
{
    //All Player's Commands.
    dcmd(rules,5,cmdtext);
    //Admins Commands.
    if(PlayerInfo[playerid][pAdminLevel] == 1)
    {
      dcmd(ann,3,cmdtext);
      dcmd(slap,4,cmdtext);
      dcmd(acar,4,cmdtext);
      dcmd(amotor,6,cmdtext);
      return 1;
    }
    if(PlayerInfo[playerid][pAdminLevel] == 2)
    {
      dcmd(freeze,6,cmdtext);
      dcmd(unfreeze,8,cmdtext);
      dcmd(mute,4,cmdtext);
      dcmd(ann,3,cmdtext);
      dcmd(slap,4,cmdtext);
      dcmd(acar,4,cmdtext);
      dcmd(amotor,6,cmdtext);
      return 1;
    }
    if(PlayerInfo[playerid][pAdminLevel] == 3)
    {
      dcmd(freeze,6,cmdtext);
      dcmd(unfreeze,8,cmdtext);
      dcmd(mute,4,cmdtext);
      dcmd(ann,3,cmdtext);
      dcmd(slap,4,cmdtext);
      dcmd(acar,4,cmdtext);
      dcmd(amotor,6,cmdtext);
      return 1;
    }
    if(PlayerInfo[playerid][pAdminLevel] == 3)
    {
      dcmd(freeze,6,cmdtext);
      dcmd(unfreeze,8,cmdtext);
      dcmd(mute,4,cmdtext);
      dcmd(ann,3,cmdtext);
      dcmd(slap,4,cmdtext);
      dcmd(acar,4,cmdtext);
      dcmd(amotor,6,cmdtext);
      return 1;
    }
    return 1;
}
Can someone help?

Little question
pawn Код:
dcmd_mute(playerid,params[])
{
    #pragma unused params
    new pname[MAX_PLAYER_NAME];
    new string[128];
    new cmdreason[100];
    new id;
    if(sscanf(params,"us[100]",id,cmdreason))
    {
        SendClientMessage(playerid,COLOR_ERROR,"Usage: /mute (Player Name/ID) (Reason)");
        return 1;
    }
    GetPlayerName(id,pname,sizeof pname);
    if(IsMuted[id] == 1)
    {
        format(string,sizeof(string),"%s(%d) is already muted by an Administrator.",pname,id);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    IsMuted[id] =1;
    format(string,sizeof(string),"An Administrator has muted %s(%d).  (Reason: %s.)",pname,id,cmdreason);
    SendClientMessageToAll(COLOR_PINK,string);

    /*format(string,sizeof(string),"9[ADMIN] Administrator has frozen %s(%d) for reason: %s.",PlayerName(ID),ID,cmdreason);
    IRC_GroupSay(gGroupID,IRC_CHANNEL,string);*/

    return 1;
}
Everything is working, except that it's not MUTING the player.
Reply
#2

You need a little code to send client message for admins. Add this stock on top of your script.

pawn Код:
stock SendClientMessageToAdmins(color, msg[]) for(new i; i < MAX_PLAYERS; i++) if(PlayerInfo[i][pAdminLevel] >= 1) SendClientMessage(i, color, msg);
After adding this, all you need to do is making a comment like "/a" and using SendClientMessageToAdmins on there.

And on second one, try adding this at OnPlayerText function;

pawn Код:
if(IsMuted[playerid] == 1) return SendClientMessage(playerid, -1, "You are currently muted!");
Reply
#3

In the Mute command, you didn't help, But thanks!

Anyone??
Reply
#4

OnPlayerText?
Reply
#5

It should work, what is the not working part of it?
Reply
#6

Every client message and shit is going right, except that the player CAN chat.
Reply
#7

It's like making
pawn Код:
dcmd_test
{
    SendClientMessage(playerid,COLOR_RED,"Hi.");
    return 1;
}
Reply
#8

It's impossible after you add the thing I gave you on OnPlayerText.
Reply
#9

Do you mean an admin chat, where admins can talk to each other?
Reply
#10

Yes Luke

Calabresi, can you post public OnPlayerText?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)