SA-MP Forums Archive
Mute cmd with Time? - 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: Mute cmd with Time? (/showthread.php?tid=418630)



Mute cmd with Time? - Youtube12 - 25.02.2013

Hi guys, I already have a mute command but not with "Time", who can help me guys....


My mute/unmute commands:

Код:
	if(strcmp(cmd, "/mute", true) == 0) // Mutes the player from talking in the chat box
	{
		new reason[128];
		new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof name);
		if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, ORANGE, "USAGE: /mute [name/id] [reason]");
				return true;
			}

			new giveplayerid = ReturnUser(tmp);
			new giveplayername[MAX_PLAYER_NAME];
			new playername[MAX_PLAYER_NAME];
			if(giveplayerid != INVALID_PLAYER_ID)
			{
				if (AccountInfo[giveplayerid][Mute] == 0)
				{
				    GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
					GetPlayerName(playerid, playername, sizeof(playername));
					reason = bigstrtok(cmdtext, idx);
					if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /mute [name/id] [reason]");
					format(string2, sizeof(string2), "ADMIN: Admin %s has set %s on the Muteliste. [reason: %s ]", playername,giveplayername,reason);
					SendClientMessageToAll(ABLAU,string2);
					AccountInfo[giveplayerid][Mute] = 1;
					SetTimerEx("UnMute",120000,0,"d",giveplayerid);
				}
				else if (AccountInfo[giveplayerid][Mute] == 1) SendClientMessage(playerid, ROT, "Error: Player is already muted.");
			}

			else if(giveplayerid == INVALID_PLAYER_ID)
			{
                        //
			}
		}
		else SendClientMessage(playerid, ROT, "Error: You aren't authorized to use this command!");
		return true;
	}

	if(strcmp(cmd, "/unmute", true) == 0) // Unmutes a muted player
	{
		if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, ORANGE, "USAGE: /unmute [name/id]");
				return true;
			}

			new giveplayerid = ReturnUser(tmp);
			new giveplayername[MAX_PLAYER_NAME];
			new playername[MAX_PLAYER_NAME];
			if(giveplayerid != INVALID_PLAYER_ID)
			{
				if (AccountInfo[giveplayerid][Mute] == 1)
				{
				    GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
					GetPlayerName(playerid, playername, sizeof(playername));
					format(string2, sizeof(string2), "ADMIN: Admin %s has removed %s from the Mutelist", playername,giveplayername);
					SendClientMessageToAll(ABLAU, string2);
					AccountInfo[giveplayerid][Mute] = 0;
				}
				else if (AccountInfo[giveplayerid][Mute] == 0) SendClientMessage(playerid, ROT, "Error: player isn't muted.");
			}

			else if(giveplayerid == INVALID_PLAYER_ID)
			{
                        //
			}
		}
		else SendClientMessage(playerid, ROT, "Error: You aren't authorized to use this command!");
		return true;
	}
And if player chat, this will happed to him


Pls help me and thanks


AW: Mute cmd with Time? - Youtube12 - 25.02.2013

Help me guys


AW: Mute cmd with Time? - Youtube12 - 25.02.2013

No one can help?