Try this mute and unmute command with Zcmd.
Hope this would be easier then that.
This under
#include <a_samp> or somewhere.
pawn Код:
new bool:ismuted[MAX_PLAYERS];
pawn Код:
COMMAND:mute(playerid, params[])
{
new id;
if(IsPlayerConnected(id))
{
if(IsPlayerAdmin(playerid))
{
if(!sscanf(params, "u", id))
{
new string[64];
new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "Adminstrator %s has muted you.", name);
SendClientMessage(id, 0xffff00aa, string);
format(string, sizeof(string), "Player %s has been muted.", PlayerName);
SendClientMessage(playerid, 0xffff00aa, string);
ismuted[id] = true;
return 1;
}
else return SendClientMessage(playerid, 0xffff00aa, "Usage:- /Mute (PlayerID/PartOfName).");
}
else return SendClientMessage(playerid, 0x0259EAAA, "You are not an Adminstrator.");
}
else return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected or The ID is incorrect..");
}
pawn Код:
COMMAND:unmute(playerid, params[])
{
new id;
if(IsPlayerConnected(id))
{
if(IsPlayerAdmin(playerid))
{
if(!sscanf(params, "u", id))
{
new string[64];
new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "Adminstrator %s has unmuted you.", name);
SendClientMessage(id, 0xffff00aa, string);
format(string, sizeof(string), "Player %s has been unmuted.", PlayerName);
SendClientMessage(playerid, 0xffff00aa, string);
ismuted[id] = false;
return 1;
}
else return SendClientMessage(playerid, 0xffff00aa, "Usage:- /Unmute (PlayerID/PartOfName).");
}
else return SendClientMessage(playerid, 0xffff00aa, "You are not an Adminstrator.");
}
else return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected or The ID is incorrect.");
}
pawn Код:
public OnPlayerText(playerid, text[])
{
if(ismuted[playerid])
{
SendClientMessage(playerid, 0xff0000FF, "You're muted, If you think you were muted wrongly please pm an admin.");
return 0;
}
return 1;
}
Thats it.