Need Some Commands, Please
#8

Here is mute and unmute, it should work, although it is untested

Mute
Код:
new Muted[MAX_PLAYERS];

public OnPlayerText(playerid, text[])
{
	if(Muted[playerid]==1)
	{
		SendClientMessage(playerid, 0xAA333300, "You are muted");
		return 0;
	}
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmd, "/mute", true) == 0)
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, 0xAA333300, "USAGE: /mute [playerid]");
			return 1;
		}
		if (!IsPlayerConnected(tmp))
		{
			new name[MAX_PLAYER_NAME], tmp2[128];
			Muted[tmp]=1;
			GetPlayerName(tmp,name,sizeof(name));
			format(tmp2,sizeof(tmp2),"Muted %s [ID:%i]",name,tmp);
			SendClientMessage(playerid, 0xAA333300, tmp2);
			return 1;
		}
	}
}

public OnPlayerDisconnect(playerid, reason)
{
	Muted[playerid]=0;
}
Unmute
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmd, "/unmute", true) == 0)
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, 0xAA333300, "USAGE: /unmute [playerid]");
			return 1;
		}
		if (!IsPlayerConnected(tmp))
		{
			new name[MAX_PLAYER_NAME], tmp2[128];
			Muted[tmp]=1;
			GetPlayerName(tmp,name,sizeof(name));
			format(tmp2,sizeof(tmp2),"Unmuted %s [ID:%i]",name,tmp);
			SendClientMessage(playerid, 0x33AA3300, tmp2);
			return 1;
		}
	}
}
Reply


Messages In This Thread
Need Some Commands, Please - by Rick_Jones - 31.08.2009, 05:28
Re: Need Some Commands, Please - by Nakash - 31.08.2009, 06:24
Re: Need Some Commands, Please - by ded - 31.08.2009, 08:35
Re: Need Some Commands, Please - by Rick_Jones - 31.08.2009, 20:07
Re: Need Some Commands, Please - by Rick_Jones - 31.08.2009, 21:54
Re: Need Some Commands, Please - by BentlyDang - 31.08.2009, 23:15
Re: Need Some Commands, Please - by Rick_Jones - 31.08.2009, 23:35
Re: Need Some Commands, Please - by Chris. - 31.08.2009, 23:51
Re: Need Some Commands, Please - by Rick_Jones - 01.09.2009, 00:40
Re: Need Some Commands, Please - by brett7 - 01.09.2009, 02:24

Forum Jump:


Users browsing this thread: 6 Guest(s)