Player mute
#1
Is it possible to have any type of player mute for a server? (!mute XXX)

Reply

#2
(02-01-2012, 19:41)kraze1994 Wrote: Is it possible to have any type of player mute for a server? (!mute XXX)
What do you mean with mute? Chat or voice chat?

Both would be possible for an admin plugin.
[Image: azuw.jpg]
Reply

#3
I would love to see both with different commands to be honest, but I would prefer voice over anything.
Reply

#4
Voice probably wouldn't be possible, chat would be possible for sure
Reply

#5
I will code a mute plugin for chat somewhere tomorrow
Reply

#6
I already made one but its in the itsmodders section, Didn't test it thats why its not public

edit: Source
Code:
using System; using Addon; namespace MW3_TextChatMute { public class TextChatMute : CPlugin { System.Collections.Generic.List<Player> MuteDb = new System.Collections.Generic.List<Player>(); System.Timers.Timer Timer = new System.Timers.Timer(); // Start the timer and show the server owner that the plugin is loaded public override void OnServerLoad() { Timer.Interval = 10000; Timer.Elapsed += new System.Timers.ElapsedEventHandler( Timer_Elapsed ); Timer.Enabled = true; Timer.Start(); ServerLog( LogType.LogData, "TextChatMute v1 loaded" ); ServerPrint( "TextChatMute v1 loaded" ); } // Check every 10 seconds if the player is still ingame, if not then delete him from the database void Timer_Elapsed( object sender, System.Timers.ElapsedEventArgs e ) { foreach ( Player player in MuteDb ) if ( !IsStillIngame( player.Client ) ) DeletePlayer( player ); } // Fix for removing players because I cannot delete them in a foreach loop o_O void DeletePlayer( Player player ) { MuteDb.Remove( player ); ServerLog( LogType.LogData, "DEBUG: Removed mutelist for: " + player.Client.Name ); player.Client = null; player.Muted = null; player = null; } // Check if the player is still ingame bool IsStillIngame( ServerClient client ) { foreach ( ServerClient player in GetClients() ) if ( client == player ) return true; return false; } // Add the player to the mute database public override void OnPlayerConnect( ServerClient Client ) { MuteDb.Add( new Player( Client ) ); ServerLog( LogType.LogData, "DEBUG: Added mutelist for: " + Client.Name ); } public override ChatType OnSay( string Message, ServerClient Client ) { // Mute a player if ( Message.StartsWith( "!mute" ) ) { if ( Message.Length <= 6 ) TellClient( Client.ClientNum, "^3Usage: !mute [Playername]", true ); else if ( GetClientByName( Message.Substring( 6 ) ) != null ) GetPlayerMute( Client ).AddMute( GetClientByName( Message.Substring( 6 ) ) ); else TellClient( Client.ClientNum, "^3There was no player found!", true ); return ChatType.ChatContinue; } // Unmute a player else if ( Message.StartsWith( "!unmute" ) ) { if ( Message.Length <= 6 ) TellClient( Client.ClientNum, "^3Usage: !unmute [Playername]", true ); else if ( GetClientByName( Message.Substring( 6 ) ) != null ) GetPlayerMute( Client ).RemoveMute( GetClientByName( Message.Substring( 6 ) ) ); else TellClient( Client.ClientNum, "^3There was no player found!", true ); return ChatType.ChatContinue; } // Show muted players else if ( Message.StartsWith( "!mutelist" ) ) { string s = "^3Muted: "; foreach ( Player player in MuteDb ) if ( player.Client == Client ) foreach ( ServerClient client in player.Muted ) s += client.Name + ", "; TellClient( Client.ClientNum, s, true ); return ChatType.ChatContinue; } // Show the text to everyone that didn't mute this Client foreach ( Player player in MuteDb ) if ( !player.IsMuted( Client ) ) TellClient( player.Client.ClientNum, Message, true ); return ChatType.ChatContinue; } // Get the 'Player' class for this client Player GetPlayerMute( ServerClient client ) { foreach ( Player player in MuteDb ) if ( player.Client == client ) return player; return null; } // Get the 'ServerClient' for this player(name) ServerClient GetClientByName( string name ) { foreach ( ServerClient client in GetClients() ) if ( client.Name.StartsWith( name, StringComparison.InvariantCultureIgnoreCase ) || client.Name.EndsWith( name, StringComparison.InvariantCultureIgnoreCase ) ) return client; return null; } } public class Player { public ServerClient Client; public System.Collections.Generic.List<ServerClient> Muted = new System.Collections.Generic.List<ServerClient>(); public Player( ServerClient client ) { Client = client; } public bool IsMuted( ServerClient client ) { return Muted.Contains( client ); } public void AddMute( ServerClient client ) { Muted.Add( client ); } public void RemoveMute( ServerClient client ) { Muted.Remove( client ); } } }
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#7
Ah nice, won't code one tomorrow then Tongue
-Bonemind
Reply

#8
(02-02-2012, 00:06)bonemind Wrote: Ah nice, won't code one tomorrow then Tongue
-Bonemind

Can you compile, test and debug it for me since I can't do this? Smile
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#9
(02-02-2012, 00:11)iAegle Wrote:
(02-02-2012, 00:06)bonemind Wrote: Ah nice, won't code one tomorrow then Tongue
-Bonemind

Can you compile, test and debug it for me since I can't do this? Smile

Will do that tomorrow, atm i'm not a great bugtester/coder/anything elseTongue
I'll post my results here ASAP though
Reply

#10
Ive compiled and tested

Bugs:
I tried unmuting my self and does not work crashed my server
!mutelist and !mute work


only thing i havent tested is muting and unmuting another person

You may test if u like.


Attached Files
.rar   MW3_TextChatMute.rar (Size: 3.06 KB / Downloads: 39)
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Sentry Gun kill = Player kill Snake 8 8,243 11-07-2013, 13:41
Last Post: Nekochan
  Player can write Fl0w_.JACKDAN 2 5,133 09-19-2013, 16:36
Last Post: Fl0w_.JACKDAN
  [CoD 4] Trying to set a player -- DidUknowiPwn 7 8,281 07-03-2013, 21:58
Last Post: Pozzuh
  [Release] Black Ops Single Player/Zombie Trainer V3.6 Craig87 52 101,656 07-01-2013, 15:12
Last Post: explosivebanana55
Video Preview AIZombies eXtreme 2.0 / Zombie Player (Music Player) DidUknowiPwn 4 8,074 06-24-2013, 16:37
Last Post: DidUknowiPwn
  "VEH_LinkCommonChecks: Player already has an owner" - After long games akillj 4 5,413 06-07-2013, 11:38
Last Post: akillj
  Question on how to "Spawn" a flying rocket as a player? akillj 8 8,504 06-04-2013, 01:54
Last Post: rotceh_dnih
  Using Cheat Engine with Zombies Single Player kikkawa 3 14,854 06-03-2013, 01:18
Last Post: kikkawa
  [Request] Random player model hillbilly 1 3,845 05-12-2013, 08:30
Last Post: archit
Brick [Release] MW3 Single Player CONSOLE v1.9.433 can1907 13 37,422 05-01-2013, 15:18
Last Post: vton

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.