Raised This Month: $ Target: $400
 0% 

Client Chat Mute


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BlackMilk
Veteran Member
Join Date: Jun 2007
Old 07-28-2007 , 13:49   Re: Client Chat Mute
Reply With Quote #1

Hey, little question.
If I install above plugin on my server and I'm muted by another player (ignoring any immunity or whatever), can he/she still see @ messages I make?

In any case, this seems like good stuff, thanks a lot =]
__________________
Mod:
User:
BlackMilk is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 07-28-2007 , 15:09   Re: Client Chat Mute
Reply With Quote #2

This only blocks "say" and "say_team", so any hudmessages or other types of text aren't blocked.
stupok is offline
Maurice
Senior Member
Join Date: Nov 2006
Location: Netherlands
Old 07-28-2007 , 17:22   Re: Client Chat Mute
Reply With Quote #3

Quote:
Originally Posted by stupok69 View Post
This plugin should have all the features you requested, Maurice.

Commands:

chatmute <name> - use to mute players
chatmutemenu - use to show a menu for muting players

Description:

When you mute a player, everyone except you will see what the player says.
Thanks! It works perfect and i'm wondering how you maded that ingame menu because i've some ideas to give this plugin even a better look.


Here a picture of the current menu




It would be even a nicer plugin if it looks like the official AMXX ingame menu's with white numbers infront of the names and the table indicater in the middle of the screen. Also the number 0 default for Exit and the 9 for more players such as can be seen in ther below picture. The script code for that ingame menu can be founded in the Recordin Assistant plugin.





Last nice modifications would be if the [muted] or [not muted] information behind the names would be only visible when you have a player muted. An picture of this can be seen again below. On the picture you see in the red text under observation and it would nice to use that manner of indication when you muted a player.




Maybe the below cheapy picture will give you a better idea of what i mean.




For myself i changed the command chatmutemenu to amx_mutemenu and chatmute to amx_mute, also /mute in any chat channel will open the mute menu. I also changed for myself the line
client_print(id, print_console, "You cannot mute an admin.")
into
client_print(id, print_chat, "You cannot mute an admin.")
so that it is in the middle of the srceen wich looks better in my mind.

As last thing that i want to say is that a public message to inform the muted player that talking to the player that have muted you is useless would be great!

e.g. [AMXX] player_name muted player_name2.
or [AMXX] player_name unmuted player_name2.
__________________
Luck? Luck is only one feeling of amazement concerning a seemingly incidental circumstance which one himself must create.

Last edited by Maurice; 07-28-2007 at 21:09.
Maurice is offline
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 07-28-2007 , 17:25   Re: Client Chat Mute
Reply With Quote #4

stupok, release this.
X-Script is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 07-29-2007 , 02:39   Re: Client Chat Mute
Reply With Quote #5

@Maurice

I did my best to do exactly what you wanted, tell me if you like it.

After spending so much time on it, maybe I should release it. There isn't another plugin exactly like it...

Code:
/*

	Thank you for the menu, xeroblood. <http://forums.alliedmods.net/showpost.php?p=112831&postcount=5>

*/

#include <amxmodx>
#include <amxmisc>

#define MENU_SIZE    256
#define MENU_PLAYERS 8

new const PLUGIN[]	= "Chat Mute"
new const VERSION[]	= "1.0"
new const AUTHOR[]	= "stupok69"

//xeroblood
new g_nMenuPosition[33]
new g_nMenuPlayers[32]
//xeroblood

new bool:gb_mute[33][33]

new g_saytext[192]

new g_maxplayers

new msgid_SayText

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	msgid_SayText = get_user_msgid("SayText")
	
	register_concmd("say", "say_handle")
	register_concmd("say_team", "say_handle")
	
	register_clcmd("say /mute",	"cmd_mutemenu",		-1,	"displays chat mute menu")
	register_clcmd("amx_mute",	"cmd_chatmute",		-1,	"<name>")
	register_clcmd("amx_mutemenu",	"cmd_mutemenu",		-1,	"displays chat mute menu")
	
	register_menucmd(register_menuid("Chat Mute"),		1023,	"handle_mutemenu")
	
	g_maxplayers = get_maxplayers() + 1
}

public say_handle(id)
{
	read_args(g_saytext, 191)
	remove_quotes(g_saytext)
	custom_say(id, g_saytext)
	
	return PLUGIN_HANDLED
}

public cmd_chatmute(id)
{
	new arg1[32]
	
	read_argv(1, arg1, 31)
	
	new player = cmd_target(id, arg1, 0)
	
	if(player)
	{
		exec_mute(id, player)
	}
	
	return PLUGIN_HANDLED
}

stock custom_say(sender, text[192])
{
	static i, name[32], buffer[256], bufferlen
	
	get_user_name(sender, name, 31)
	
	buffer[0] = 0x03
	
	bufferlen = format(buffer[1], 254, "%s", name)
	
	buffer[bufferlen+1] = 0x01
	
	format(buffer[bufferlen+2], 200, " : %s", text)
	
	buffer[192] = '^0'
	
	for(i = 1; i < g_maxplayers; i++)
	{
		if(!is_user_connected(i))
			continue
		
		if(gb_mute[i][sender])
		{
			continue
		}
		else
		{
			message_begin(MSG_ONE, msgid_SayText, _, i)
			write_byte(get_id_on_this_team(get_user_team(sender)))
			write_string(buffer)
			message_end()
		}
	}
}

stock exec_mute(id, target)
{
	if(access(target, ADMIN_KICK))
	{
		client_print(id, print_chat, "[AMXX] You cannot mute an admin.")
		return 0
	}
	
	gb_mute[id][target] = !gb_mute[id][target]
	
	new name[32], name2[32]
	
	get_user_name(target, name, 31)
	
	get_user_name(id, name2, 31)
	
	client_print(0, print_chat, "[AMXX] %s has %smuted %s chat.", name2, (gb_mute[id][target] ? "" : "un"), name)
	
	return 1
}

stock get_id_on_this_team(team)
{
	static i
	
	for(i = 1; i < g_maxplayers; i++)
	{
		if(team == get_user_team(i))
		{
			return i
		}
	}
	
	return 0
}

/*
	xeroblood's fantastic menu, customized
*/
public cmd_mutemenu(id)
{
	show_mutemenu(id, g_nMenuPosition[id] = 0)
}

public handle_mutemenu(id, key)
{
	switch(key)
	{
		case 8: show_mutemenu(id, ++g_nMenuPosition[id])
		
		case 9: show_mutemenu(id, --g_nMenuPosition[id])
		
		default:
		{
			new nPlayerID = g_nMenuPlayers[g_nMenuPosition[id] * MENU_PLAYERS + key]
			
			exec_mute(id, nPlayerID)
			
			show_mutemenu(id, g_nMenuPosition[id])
		}
	}
	
	return PLUGIN_HANDLED
}

public show_mutemenu(id, pos)
{
	if(pos < 0) return

	new i, iPlayerID
	new szMenuBody[MENU_SIZE]
	new nCurrKey = 0
	new szUserName[32]
	new nStart = pos * MENU_PLAYERS
	new nNum

	get_players(g_nMenuPlayers, nNum)

	if(nStart >= nNum)
		nStart = pos = g_nMenuPosition[id] = 0
	
	new nLen = format(szMenuBody, MENU_SIZE-1, "\yChat Menu%60s%i/%i^n^n", "", pos+1, (nNum / MENU_PLAYERS + ((nNum % MENU_PLAYERS) ? 1 : 0 )))
	new nEnd = nStart + MENU_PLAYERS
	new nKeys = (1<<9)
	
	if( nEnd > nNum )
		nEnd = nNum
	
	for(i = nStart; i < nEnd; i++)
	{
		iPlayerID = g_nMenuPlayers[i]
		get_user_name(iPlayerID, szUserName, 31)
		
		if(access(iPlayerID, ADMIN_KICK))
		{
			nCurrKey++
			nLen += format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "\d%i. %s^n\w", nCurrKey, szUserName)
		}
		else
		{
			nKeys |= (1<<nCurrKey++)
			nLen += format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "%i. %s \r%s\w^n", nCurrKey, szUserName, (gb_mute[id][iPlayerID] ? "mute" : ""))
		}
	}
	
	if(nEnd != nNum)
	{
		format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n9. More...^n0. %s", pos ? "Back" : "Exit")
		nKeys |= (1<<8)
	}
	else
		format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n0. %s", pos ? "Back" : "Exit")
	
	show_menu(id, nKeys, szMenuBody, -1)
	
	return
}
stupok is offline
Maurice
Senior Member
Join Date: Nov 2006
Location: Netherlands
Old 07-29-2007 , 13:33   Re: Client Chat Mute
Reply With Quote #6

Awesome you manage to make all what i requested! The reason for my request are not only so the plugin fits better for me but also for all other users of it and indeed you should release it, actually it should be part of AMXX mainly because it is so helpfull for every player and it looks like just as all other standard AMXX plugins.

I noticed some minor things that have to be fixed or can make the plugin better.

First thing is that need to be changed or the ingame menu won't work is the menu name in the line:
register_menucmd(register_menuid("Chat Mute"), 1023, "handle_mutemenu")

It must be the same as in this line:
new nLen = format(szMenuBody, MENU_SIZE-1, "\yChat Menu%60s%i/%i^n^n", "", pos+1, (nNum / MENU_PLAYERS + ((nNum % MENU_PLAYERS) ? 1 : 0 )))

After both lines have the same menu name the ingame menu works but sometimes the menu not contain all character especially when the menu have long player names or just much character. I think it's because somewhere is defined the max characters of the menu, e.g. (#define MENU_SIZE 256). The menu options still works even if it is not vissible so the problemis not that big to fix it i think. As last thing that should be fixed is that the first player name in the menu is yellow instead of white as it should be.

I've some new requests what makes the plugin proberly even better, Muting yourself is somewhat useless and should not be possible. Also a max of "x" mutes per "x" time should be possible otherwise people will flood the HUD. This can maybe be done with a minimal "x" seconds you have to wait before you can again (un)mute a player or a better way would be that you can just not flood the HUD and if you have for example 4 players (un)muted in 1 second you have to wait for "x" seconds before you can mute agian such as the standard amx_flood_time command for say say_team commands. This last request is not really needed and if it is hard or even impossible to make it is not a problem because this plugin even briljant without that option.

To show you what i just writed all above i add here a link for a zip file with some screenshots or you can just test is your self at 84.244.166.224:27015
__________________
Luck? Luck is only one feeling of amazement concerning a seemingly incidental circumstance which one himself must create.

Last edited by Maurice; 07-29-2007 at 22:07.
Maurice is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 07-29-2007 , 14:47   Re: Client Chat Mute
Reply With Quote #7

I'm glad you like it, and thanks for the detailed report of all the problems.

This version fixes all the issues you mentioned and also includes flood-protection. The flood-protection time is taken from the cvar "amx_flood_time".

Enjoy!

Code:
/*

	Thank you for the menu, xeroblood. <http://forums.alliedmods.net/showpost.php?p=112831&postcount=5>

*/

#include <amxmodx>
#include <amxmisc>

#define MENU_SIZE    512
#define MENU_PLAYERS 8

new const PLUGIN[]	= "Chat Mute"
new const VERSION[]	= "1.0"
new const AUTHOR[]	= "stupok69"

//xeroblood
new g_nMenuPosition[33]
new g_nMenuPlayers[32]
//xeroblood

new bool:gb_mute[33][33]

new Float:gf_time[33]

new g_saytext[192]

new g_maxplayers

new msgid_SayText

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	msgid_SayText = get_user_msgid("SayText")
	
	register_concmd("say", "say_handle")
	register_concmd("say_team", "say_handle")
	
	register_clcmd("say /mute",	"cmd_mutemenu",		-1,	"displays chat mute menu")
	register_clcmd("amx_mute",	"cmd_chatmute",		-1,	"<name>")
	register_clcmd("amx_mutemenu",	"cmd_mutemenu",		-1,	"displays chat mute menu")
	
	register_menucmd(register_menuid("Chat Mute"),		1023,	"handle_mutemenu")
	
	g_maxplayers = get_maxplayers() + 1
}

public say_handle(id)
{
	read_args(g_saytext, 191)
	remove_quotes(g_saytext)
	custom_say(id, g_saytext)
	
	return PLUGIN_HANDLED
}

public cmd_chatmute(id)
{
	new arg1[32]
	
	read_argv(1, arg1, 31)
	
	new player = cmd_target(id, arg1, 0)
	
	if(player)
	{
		exec_mute(id, player)
	}
	
	return PLUGIN_HANDLED
}

stock custom_say(sender, text[192])
{
	static i, name[32], buffer[256], bufferlen
	
	get_user_name(sender, name, 31)
	
	buffer[0] = 0x03
	
	bufferlen = format(buffer[1], 254, "%s", name)
	
	buffer[bufferlen+1] = 0x01
	
	format(buffer[bufferlen+2], 200, " : %s", text)
	
	buffer[192] = '^0'
	
	for(i = 1; i < g_maxplayers; i++)
	{
		if(!is_user_connected(i))
			continue
		
		if(gb_mute[i][sender])
		{
			continue
		}
		else
		{
			message_begin(MSG_ONE, msgid_SayText, _, i)
			write_byte(get_id_on_this_team(get_user_team(sender)))
			write_string(buffer)
			message_end()
		}
	}
}

stock exec_mute(id, target)
{
	if(access(target, ADMIN_KICK))
	{
		client_print(id, print_chat, "[AMXX] You cannot mute an admin.")
		return 0
	}
	
	new Float:current_time = get_gametime()
	new Float:interval = get_cvar_float("amx_flood_time")
	
	if(current_time > gf_time[id] + interval)
	{
		gf_time[id] = current_time
	}
	else
	{
		client_print(id, print_chat, "[AMXX] Please wait %f seconds to mute again.", interval)
		return 0
	}
	
	gb_mute[id][target] = !gb_mute[id][target]
	
	new name[32], name2[32]
	
	get_user_name(target, name, 31)
	
	get_user_name(id, name2, 31)
	
	client_print(0, print_chat, "[AMXX] %s has %smuted %s chat.", name2, (gb_mute[id][target] ? "" : "un"), name)
	
	return 1
}

stock get_id_on_this_team(team)
{
	static i
	
	for(i = 1; i < g_maxplayers; i++)
	{
		if(team == get_user_team(i))
		{
			return i
		}
	}
	
	return 0
}

/*
	xeroblood's fantastic menu, customized
*/
public cmd_mutemenu(id)
{
	show_mutemenu(id, g_nMenuPosition[id] = 0)
}

public handle_mutemenu(id, key)
{
	switch(key)
	{
		case 8: show_mutemenu(id, ++g_nMenuPosition[id])
		
		case 9: show_mutemenu(id, --g_nMenuPosition[id])
		
		default:
		{
			new nPlayerID = g_nMenuPlayers[g_nMenuPosition[id] * MENU_PLAYERS + key]
			
			exec_mute(id, nPlayerID)
			
			show_mutemenu(id, g_nMenuPosition[id])
		}
	}
	
	return PLUGIN_HANDLED
}

public show_mutemenu(id, pos)
{
	if(pos < 0) return

	new i, iPlayerID
	new szMenuBody[MENU_SIZE]
	new nCurrKey = 0
	new szUserName[32]
	new nStart = pos * MENU_PLAYERS
	new nNum

	get_players(g_nMenuPlayers, nNum)

	if(nStart >= nNum)
		nStart = pos = g_nMenuPosition[id] = 0
	
	new nLen = format(szMenuBody, MENU_SIZE-1, "\yChat Mute%60s%i/%i^n^n\w", "", pos+1, (nNum / MENU_PLAYERS + ((nNum % MENU_PLAYERS) ? 1 : 0 )))
	new nEnd = nStart + MENU_PLAYERS
	new nKeys = (1<<9)
	
	if( nEnd > nNum )
		nEnd = nNum
	
	for(i = nStart; i < nEnd; i++)
	{
		iPlayerID = g_nMenuPlayers[i]
		get_user_name(iPlayerID, szUserName, 31)
		
		if(access(iPlayerID, ADMIN_KICK) || iPlayerID == id)
		{
			nCurrKey++
			nLen += format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "\d%i. %s^n\w", nCurrKey, szUserName)
		}
		else
		{
			nKeys |= (1<<nCurrKey++)
			nLen += format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "%i. %s \r%s\w^n", nCurrKey, szUserName, (gb_mute[id][iPlayerID] ? "mute" : ""))
		}
	}
	
	if(nEnd != nNum)
	{
		format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n9. More...^n0. %s", pos ? "Back" : "Exit")
		nKeys |= (1<<8)
	}
	else
		format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n0. %s", pos ? "Back" : "Exit")
	
	show_menu(id, nKeys, szMenuBody, -1)
	
	return
}
__________________
stupok is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-29-2007 , 14:50   Re: Client Chat Mute
Reply With Quote #8

Nice stupok! I like the idea...you should release this ....Gj
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Maurice
Senior Member
Join Date: Nov 2006
Location: Netherlands
Old 07-29-2007 , 22:00   Re: Client Chat Mute
Reply With Quote #9

Thanks stupok69, again you managed to make all the ideas in the plugin! The plugin is now on one of my public servers to give it a big test. If there would still be some fixes or changements needed i will notify you. thanks again for making this briljant and usefull plugin.
__________________
Luck? Luck is only one feeling of amazement concerning a seemingly incidental circumstance which one himself must create.

Last edited by Maurice; 07-29-2007 at 22:02.
Maurice is offline
BlackMilk
Veteran Member
Join Date: Jun 2007
Old 07-30-2007 , 04:54   Re: Client Chat Mute
Reply With Quote #10

^ Reason I still make suggestions on this forum xD
I'll try the updated version myself too, ty Stupok.
__________________
Mod:
User:
BlackMilk is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode