07.06.2015, 10:40
It's not hard... Also, i forgot to add the key piece, in onplayertext, sorry for that :P
Here's the things you need to add (forget about the previous ones ofc)
And I guess you may need an unmute command, just in case:
And this under OnPlayerText callback
Here's the things you need to add (forget about the previous ones ofc)
pawn Код:
CMD:mute(playerid,params[])
{
if(pInfo[playerid][Admin]>=3)
{
new plid,reason[64];
if(sscanf(params,"us[64]",plid,reason)) return SCM(playerid,COLOR_GREY,"INFO: /mute [playerid][reason]");
if(!IsPlayerConnected(plid)) return SCM(playerid,COLOR_GREY,"No such player");
new adminname[MAX_PLAYER_NAME],playername[MAX_PLAYER_NAME],string[256];
GetPlayerName(playerid,adminname,sizeof(adminname));
GetPlayerName(plid,playername,sizeof(playername));
format(string,sizeof(string),"[ADMIN] {%06x}%s {FF6347}was muted by {%06x}%s{FF6347}, reason: {33CCFF}%s",GetPlayerColor(plid)>>>8,playername,GetPlayerColor(playerid)>>>8,adminname,reason);
SendClientMessageToAll(COLOR_LIGHTRED,string);
pInfo[plid][Muted]=1;
}
else return SCM(playerid,COLOR_LIGHTRED,"You are not allowed to use this command!");
return 1;
}
pawn Код:
CMD:unmute(playerid,params[])
{
if(pInfo[playerid][Admin]>=3)
{
new plid;
if(sscanf(params,"u",plid)) return SCM(playerid,COLOR_GREY,"INFO: /unmute [playerid][reason]");
if(!IsPlayerConnected(plid)) return SCM(playerid,COLOR_GREY,"No such player");
new adminname[MAX_PLAYER_NAME],playername[MAX_PLAYER_NAME],string[256];
GetPlayerName(playerid,adminname,sizeof(adminname));
GetPlayerName(plid,playername,sizeof(playername));
format(string,sizeof(string),"[ADMIN] {%06x}%s {FF6347}was unmuted by {%06x}%s{FF6347}",GetPlayerColor(plid)>>>8,playername,GetPlayerColor(playerid)>>>8,adminname);
SendClientMessageToAll(COLOR_LIGHTRED,string);
pInfo[plid][Muted]=0;
}
else return SCM(playerid,COLOR_LIGHTRED,"You are not allowed to use this command!");
return 1;
}
pawn Код:
if(pInfo[playerid][Muted]) return SendClientMessage(playerid,COLOR_LIGHTRED,"You can't talk because you're muted!");