SA-MP Forums Archive
Problem with Command /mute - 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: Problem with Command /mute (/showthread.php?tid=587958)



Problem with Command /mute - John997 - 04.09.2015

means when players to quieten (mute) although write time will be muted during this time is not running does nothing and the player is muted until I do not / unmute if we can fix the timer counts down to after a while un - mute
Vreme =Time

Код:
CMD:mute(playerid,params[])
{

    if(UlogovanProvera[playerid] == 0) return Ulogovan(playerid);
	new ID, Vreme, Razlog[64], str[128];
	if(PlayerInfo[playerid][pAdmin] < 2) return Ovlasteni(playerid);
	if(AdminDuty[playerid] == 0) return Duznost(playerid);
	if(sscanf(params, "uis[64]", ID, Vreme, Razlog)) return SCM(playerid, -1, ""ORANGE"[ARP - INFO] "BELA"/mute [ID/Nick] [Vreme (minuta)] [Razlog]");
	if(PlayerInfo[ID][pMutiran] == 1) return SCM(playerid,-1,""CRVENA"#GRESKA: "BELA"Taj igrac je vec mutiran!");
	if(Vreme < 1 || Vreme > 60) return SCM(playerid, -1, ""CRVENA"#GRESKA: "BELA"Ne mozete mutirati igraca manje od 1 minuta i vise od 60 minuta!");
	if(!IsPlayerConnected(ID)) return SCM(playerid, -1, ""CRVENA"#GRESKA: "BELA"Pogresan ID!");
	PlayerInfo[ID][pMutiran] = 1;
	PlayerInfo[ID][pMutiranVreme] = Vreme*60;
	format(str,sizeof str,""ZUTA"MUTE: "BELA"Mutirani ste od strane admina %s na %d | Razlog: %s!", GetName(playerid), Vreme, Razlog);
	SCM(ID,-1,str);
	format(str,sizeof str,""ZUTA"MUTE: "BELA"Mutirali ste igraca %s na %d | Razlog: %s!", GetName(ID), Vreme, Razlog);
	SCM(playerid,-1,str);
	return 1;
}
///////////////////////////////////////////////////////
CMD:unmute(playerid,params[])
{

    if(UlogovanProvera[playerid] == 0) return Ulogovan(playerid);
	new pid,str[128];
	if(PlayerInfo[playerid][pAdmin] < 3) return Ovlasteni(playerid);
    if(AdminDuty[playerid] == 0) return Duznost(playerid);
	if(sscanf(params, "u", pid)) return SCM(playerid,-1,""ORANGE"[ARP - INFO] "BELA"/unmute [id]");
	if(PlayerInfo[pid][pMutiran] == 0) return SCM(playerid,-1,""CRVENA"#GRESKA: "BELA"Taj igrac nije mutiran!");
	if(!IsPlayerConnected(pid)) return SCM(playerid, -1, ""CRVENA"#GRESKA: "BELA"Pogresan ID!");
	PlayerInfo[pid][pMutiran] = 0;
	format(str,sizeof str,""ZUTA"UNMUTE: "BELA"Admin %s vas je unmutirao | Sada mozete ponovo pisati!", GetName(playerid));
	SCM(pid,-1,str);
	format(str,sizeof str,""ZUTA"UNMUTE: "BELA"Unmutirali ste %s | Sada moze ponovo pisati!", GetName(pid));
	SCM(playerid,-1,str);
	return 1;
}



Re: Problem with Command /mute - Nour1 - 04.09.2015

This is the right code edit it and make an time on /mut'ing someone

Quote:

CMD:mute(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new string[128], giveplayerid;
if(sscanf(params, "i", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /mute [playerid]");

if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid == playerid)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You can not use this command on yourself!");
return 1;
}

if(PlayerInfo[giveplayerid][pMuted] == 0)
{
if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin])
{
format(string, sizeof(string), "%s just tried to /mute you.",GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_YELLOW, string);
SendClientMessageEx(playerid, COLOR_WHITE, "You can't perform this action on an equal or higher level administrator.");
return 1;
}
PlayerInfo[giveplayerid][pMuted] = 1;
format(string, sizeof(string), "AdmCmd: %s was silenced by %s.",GetPlayerNameEx(giveplayerid),GetPlayerNameEx (playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
}
else
{
PlayerInfo[giveplayerid][pMuted] = 0;
format(string, sizeof(string), "AdmCmd: %s was unsilenced by %s.",GetPlayerNameEx(giveplayerid),GetPlayerNameEx (playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}