[Help] Mute Command
#1

Hi guys i create my mute command after i read some about timers and how they work
My codes
In the top of script after colors etc
pawn Код:
new Mutetimer[MAX_PLAYERS];
new Muted[MAX_PLAYERS];
My commands
pawn Код:
CMD:mute(playerid,params[])
{
    if(PlayerInfo[playerid][pAdminLevel] == 0) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]:{FAF5F5}You are not{FF0000} Administrator {FAF5F5}to use this command");
    new id,time,reason[100],PlayerName[MAX_PLAYER_NAME],GPlayerName[MAX_PLAYER_NAME],String[126];
    if(sscanf(params,"dds[30]",id,time,reason)) return SendClientMessage(playerid, -1, "{FF0000}[System Usage]:{FAF5F5}/mute [playerid] [time] [reason]");
    if (!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "{FF0000}[ERROR]:{FAF5F5}Player is not connected!");
    if(Muted[id] == 1) return SendClientMessage(playerid, -1, "{FF0000}[ERROR]:{FAF5F5}This player already muted!");
    GetPlayerName(id, PlayerName, sizeof(PlayerName));
    GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));
    format(String, sizeof(String), "{FF0000}Adminstrator{FAF5F5}%s has mute %s for %d mins | Reason:{FF0000} %s", GetPlayerNameEx(playerid),GetPlayerNameEx(id), time, reason);
    SendClientMessageToAll(-1, String);
    Mutetimer[id] = SetTimerEx("Unmute",time*6000, false, "i", id);
    return 1;
}
CMD:unmute(playerid,params[])
{
    new id;
    if(PlayerInfo[playerid][pAdminLevel] == 0) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]:{FAF5F5}You are not{FF0000} Administrator {FAF5F5}to use this command");
    if(sscanf(params,"u",id)) return SendClientMessage(playerid, -1, "{FF0000}[System Usage]:{FAF5F5}/unmute [playerid]");
    KillTimer(Mutetimer[id]);
    return 1;
}
I just need help now please in OnPlayertext to define that if he muted it return and Sendclientmessage to him saying that You are muted from chating you can't talk
-Thanks.
Reply
#2

Just put at the start of OnPlayerText, when he tries to speak:

pawn Код:
if(Muted[playerid]) return SendClientMessage(playerid, -1, "You're muted");
Reply
#3

Thank you for reply , i will test it now thanks!
Reply
#4

Not working , i can chat normally

PS:Nevermind , fixed.
Reply
#5

Just for reference, Don't double post on the same day.
Reply
#6

Try this:

pawn Код:
if(Muted[playerid])
{
    SendClientMessage(playerid, -1, "You're muted");
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)