18.04.2009, 10:13
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
Thanks
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; } |
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;
}
Originally Posted by Jakku
Quote:
|
//Top of script
new Muted[MAX_PLAYERS];
public OnPlayerText(playerid, text[])
{
if(Muted[playerid] == 1)
{
SendClientMessage(playerid, RED, " You are muted and cannot talk. ");
return 0;
}
return 1;
}
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;
}
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;
}