Code:
CMD:mute(PARAMS)
{
LoginCheck(playerid);
LevelCheck(playerid, 6);
if(sscanf(params, "uD(0)", params[0], params[1])) return SendUsage(playerid, "/mute "GREY"<id> <time> "W"NOTICE: "GREY"Time must be in minutes! (If time was not set, Mute forever)", "Will mute the player with time, player cannt mute-evade this");
else
{
CheckImune(playerid, params[0]);
if(params[0] == (0xFFFF)) return SendError(playerid, "Player not connected!");
if(params[0] == playerid) return SendError(playerid, "You cannot mute yourself!");
if(P_DATA[params[0]][Mute]) return SendError(playerid, "Player is already Mute!");
if(!params[1])
{
P_DATA[params[0]][Mute] = 1;
P_DATA[params[0]][MuteTime] = 0;
#if SAVE_MUTE == true
new
pQue[256];
format(pQue, 256, "SELECT `Key` FROM `Mute` WHERE `IP` = '%s'", GetPlayerIPEx(params[0]));
new DBResult:R1 = DB::Query(_DB, pQue);
if(R1)
{
if(!DB::Valid(R1))
{
DB::Free(R1);
format(pQue, sizeof (pQue), "INSERT INTO `Mute` VALUES (NULL, '%s', '1', '0', '%s')", GetPlayerIPEx(params[0]), Name(params[0]));
DB::Query(_DB, pQue);
}
else
{
DB::Free(R1);
format(pQue, sizeof (pQue), "UPDATE `Mute` SET `Mute` = '1', `Time` = '0', `RealName` = '%s' WHERE `IP` = '%s'", Name(params[0]), GetPlayerIPEx(params[0]));
DB::Query(_DB, pQue);
}
}
#endif
SendAdminCMD(playerid, "Admin "ORAN"%s[%i]"GREY" Mute player "ORAN"%s[%i]", Name(playerid), playerid, Name(params[0]), params[0], params[1]);
FormatMSG(playerid, Color:GREY, "You Mute "ORAN"%s[%i]", Name(params[0]), params[0]);
SendClientMessage(params[0], Color:GREY, "You have been Mute!");
}
else
{
P_DATA[params[0]][Mute] = 1;
SendAdminCMD(playerid, "Admin "ORAN"%s[%i]"GREY" Mute player "ORAN"%s[%i] "GREY"["ORAN"Time: "W"%d"GREY" minutes[", Name(playerid), playerid, Name(params[0]), params[0], params[1]);
FormatMSG(playerid, Color:GREY, "You Mute "ORAN"%s[%i] "GREY"["ORAN"Time: "W"%d"GREY" minutes[", Name(params[0]), params[0], params[1]);
FormatMSG(params[0], Color:GREY, "You have been Mute! "W"["GREE"Time: "W"%d"GREY" minutes"W"[", params[1]);
#if SAVE_MUTE == true
new
pQue[256];
format(pQue, 256, "SELECT `Key` FROM `Mute` WHERE `IP` = '%s'", GetPlayerIPEx(params[0]));
new DBResult:R1 = DB::Query(_DB, pQue);
if(R1)
{
if(!DB::Valid(R1))
{
DB::Free(R1);
format(pQue, sizeof (pQue), "INSERT INTO `Mute` VALUES (NULL, '%s', '1', '%d', '%s')", GetPlayerIPEx(params[0]), params[1], Name(params[0]));
DB::Query(_DB, pQue);
}
else
{
DB::Free(R1);
format(pQue, sizeof (pQue), "UPDATE `Mute` SET `Mute` = '1', `Time` = '%d', `RealName` = '%s' WHERE `IP` = '%s'", params[1], Name(params[0]), GetPlayerIPEx(params[0]));
DB::Query(_DB, pQue);
}
}
#endif
KillTimer(MuteTimer[params[0]]);
MuteTimer[params[0]] = SetTimerEx("UnMutePlayer", 60_000, true, "i", params[0]);
P_DATA[params[0]][MuteTime] = params[1];
}
}
return 1;
}
CMD:unmute(PARAMS)
{
LoginCheck(playerid);
LevelCheck(playerid, 6);
if(sscanf(params, "u", params[0])) return SendUsage(playerid, "/unmute "GREY"<id>", "Will unmute the specified player");
else
{
CheckImune(playerid, params[0]);
if(params[0] == (0xFFFF)) return SendError(playerid, "Player not connected!");
if(params[0] == playerid ) return SendError(playerid, "You cannot unmute yourself!");
if(!P_DATA[params[0]][Mute]) return SendError(playerid, "Player is not Mute!");
P_DATA[params[0]][Mute] = 0;
P_DATA[params[0]][MuteTime] = 0;
KillTimer(MuteTimer[params[0]]);
#if SAVE_MUTE == true
new
Query[256];
format(Query, 256, "DELETE FROM `Mute` WHERE `IP` = '%s'", GetPlayerIPEx(params[0]));
DB::Query(_DB, Query);
#endif
SendAdminCMD(playerid, "Admin "ORAN"%s[%i]"GREY" unMute player "ORAN"%s[%i]", Name(playerid), playerid, Name(params[0]), params[0]);
FormatMSG(playerid, Color:GREY, "You unMute "ORAN"%s[%i]", Name(params[0]), params[0]);
SendClientMessage(params[0], Color:GREY, "You have been unMute!");
}
return 1;
}