How to mute peoples' in-game text?

How do I mute peoples’ in-game text?

bump

Are you talking about the text taunts, for example if you type “Hi” you player will literally say “Hi” out loud?

I think he means censoring their text chat. Which isn’t possible without a “gag” administration punishment from a third party addon. (ulx, ass, etc)

Client-side:



//Shitty client-side gagging.

local Gagged_Players = {};

local function IsGagged( pl )
	for k in pairs( Gagged_Players ) do
		if( pl:Name():lower():find( k ) ) then
			return true;
		end
	end
	return false;
end

local function GagPlayer( _, __, args )
	if( #args == 0 ||
	args[1] == nil ) then
		Msg( "
Usage: gag_player <name>
" );
		return;
	end
	Gagged_Players[args[1]:lower()] = true;
end

concommand.Add( "gag_player", GagPlayer );

local function UngagPlayer( _, __, args )
	if( #args == 0 ||
	args[1] == nil ) then
		Msg( "
Usage: ungag_player <name>
" );
		return;
	end
	Gagged_Players[args[1]:lower()] = nil;
end

concommand.Add( "ungag_player", UngagPlayer );

local function OnChat( pl, msg, isteam, idead )
	if( IsGagged( pl ) ) then
		Msg( "
debug
" );
		return true; //Suppress chat.
	end
	return false;
end
hook.Add( "OnPlayerChat", "OnChat", OnChat );


Untested, but it should work. If you want it for your server, you could do something similar; just hook PlayerSay instead, and do a check for SteamID and name.

use !mute in ULX to mute players text, and use !gag to mute voice chat