Mute- command
#1

I need mute command what mutes player and cant speak. And If possible when player got muted send muted player message: You have been muted or something like that.


Thanks
Reply
#2

AccInfo[playerid][Muted] = 1; <--Player Is muted
AccInfo[playerid][Muted] = 0; <--Player Is not muted

Under 'OnPlayerText',

if(AccountInfo[playerid][Mute] == 1)
{
SendClientMessage(playerid, RED, "SERVER: You are muted.");
return 0;
}
Reply
#3

Be sure that you have defined enum AccInfo and variable Muted, else you will not succeed in compiling.
Reply
#4

Quote:
Originally Posted by Fatal
AccInfo[playerid][Muted] = 1; <--Player Is muted
AccInfo[playerid][Muted] = 0; <--Player Is not muted

Under 'OnPlayerText',

if(AccountInfo[playerid][Mute] == 1)
{
SendClientMessage(playerid, RED, "SERVER: You are muted.");
return 0;
}
That does not help me at all
Reply
#5

why not, he gave the steps, just make a command of it.
Reply
#6

pawn Код:
if(!strcmp(cmd,"/mute",true))
{
  cmd=strtok(cmdtext,idx);
  if(!strlen(cmd)) return SendClientMessage(playerid,color,"USAGE: /mute [playerid/name]");
  id=ReturnUser(cmd);
  if(!IsPlayerConnected(id)) return SendClientMessage(palyerid,color,"Invalid player ID.");
  AccountInfo[id][mute]=1;
  format(string,sizeof(string)," You muted %s.",namevariebleofid");
  SendClientMessage(playerid,color,string);
  format(string,sizeof(string),"
%s muted you.",namevariebleofplayerid");
  SendClientMessage(playerid,color,string);
  return 1;
}
Reply
#7

Quote:
Originally Posted by Jakku
Quote:
Originally Posted by Fatal
AccInfo[playerid][Muted] = 1; <--Player Is muted
AccInfo[playerid][Muted] = 0; <--Player Is not muted

Under 'OnPlayerText',

if(AccountInfo[playerid][Mute] == 1)
{
SendClientMessage(playerid, RED, "SERVER: You are muted.");
return 0;
}
That does not help me at all
Of coarse, because you have no scripting knowledge, this isn't a section where you can request stuff, if you want something made for you, go here --> http://forum.sa-mp.com/index.php?topic=94387.0.

I gave you the basic info, so that you can make your own thing out of it.
Reply
#8

pawn Код:
//Top of script
new Muted[MAX_PLAYERS];
pawn Код:
public OnPlayerText(playerid, text[])
{
  if(Muted[playerid] == 1)
  {
   SendClientMessage(playerid, RED, " You are muted and cannot talk. ");
   return 0;
  }
  return 1;
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];
  new tmp[256];
  new idx;
  cmd = strtok(cmdtext, idx);

  if(strcmp(cmd, " /mute ", true) == 0)
  {
   if(IsPlayerAdmin(playerid))
   {
     tmp = strtok(cmdtext, idx);
     if(!strlen(tmp)) return SendClientMessage(playerid, color, " Usage: /mute [id] ");
     new giveplayerid = strval(tmp);
     if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, color, " Player not connected ! ");
     new name[24], name2[24], str[128];
     GetPlayerName(playerid, name, 24);
     GetPlayerName(giveplayerid, name2, 24);
     format(str, sizeof str, " Administrator %s has muted %s ", name, name2);
     SendClientMessageToAll(color, str);
     Muted[giveplayerid] = 1;
     return 1;
   }
   else return SendClientMessage(playerid, color, " Not an administrator! ");
  }
  return 0;
}
Reply
#9

Then I need unmute too :P
Reply
#10

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];
  new tmp[256];
  new idx;
  cmd = strtok(cmdtext, idx);

  if(strcmp(cmd, " /unmute ", true) == 0)
  {
   if(IsPlayerAdmin(playerid))
   {
     tmp = strtok(cmdtext, idx);
     if(!strlen(tmp)) return SendClientMessage(playerid, color, " Usage: /unmute [id] ");
     new giveplayerid = strval(tmp);
     if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, color, " Player not connected ! ");
     new name[24], name2[24], str[128];
     GetPlayerName(playerid, name, 24);
     GetPlayerName(giveplayerid, name2, 24);
     format(str, sizeof str, " Administrator %s has unmuted %s ", name, name2);
     SendClientMessageToAll(color, str);
     Muted[giveplayerid] = 0;
     return 1;
   }
   else return SendClientMessage(playerid, color, " Not an administrator! ");
  }
  return 0;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)