Mute Command
#1

I have this command but when they mute you you can speak
I want to add a timer too.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

 if(!strcmp(cmdtext, "/mute", true, 5))
{


    new Muted[MAX_PLAYERS];
   
if(!strlen(cmdtext[6]))
  {
    SendClientMessage(playerid, COLOR_RED, "Usage: /mute [playerid]");
    return 1;
  }
new ID = strval(cmdtext[6]);
new pName[24], str[64];

if(IsPlayerConnected(ID))
  {
    GetPlayerName(ID, pName, 24);
    format(str, 64, "%s has been muted", pName);
    SendClientMessageToAll(COLOR_RED, str);
    print(str);
    Muted[playerid] = 1;
  }
  return 1;

    }
    return 0;
}
Reply
#2

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(Muted[playerid] == 1)
    {
    SendClientMessage(playerid,COLOR_RED,"You are muted. You can`t chat");
    return 0; // important must be 0
    }
    return 1;
}
Reply
#3

Not working :/
Reply
#4

Ah, try putting the
pawn Код:
new Muted[MAX_PLAYERS];
as a global array, under #includes ... and delete the one in the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)