[Help] Mute Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help] Mute Command (
/showthread.php?tid=461392)
[Help] Mute Command -
SilentSoul - 01.09.2013
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.
Re: [Help] Mute Command -
DanishHaq - 01.09.2013
Just put at the start of OnPlayerText, when he tries to speak:
pawn Код:
if(Muted[playerid]) return SendClientMessage(playerid, -1, "You're muted");
Re: [Help] Mute Command -
SilentSoul - 01.09.2013
Thank you for reply , i will test it now thanks!
Re: [Help] Mute Command -
SilentSoul - 01.09.2013
Not working
, i can chat normally
PS:Nevermind , fixed.
Re: [Help] Mute Command -
zT KiNgKoNg - 01.09.2013
Just for reference, Don't double post on the same day.
Re: [Help] Mute Command -
DanishHaq - 01.09.2013
Try this:
pawn Код:
if(Muted[playerid])
{
SendClientMessage(playerid, -1, "You're muted");
return 0;
}