Author Topic: Request: Auto-mute patch, specific  (Read 7014 times)

Rawr

  • Posts: 918
  • Turrets: +1/-1
Request: Auto-mute patch, specific
« on: May 29, 2007, 07:05:49 pm »
Hello all you coders out there ;)
I am interested in a patch that will specifically mute one person when they say a specific word.
For instance,
If player "Kattana" says "n00b"
Server: Kattana was muted by console.

I know kevlarman wrote something like this, only it wasn't specific to a curtain player.
img]http://dvclan.org/statsig/statsig.php/3826/4.jpg[/img]

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
Re: Request: Auto-mute patch, specific
« Reply #1 on: May 29, 2007, 07:38:26 pm »
Quote from: "Rawr"
I know kevlarman wrote something like this, only it wasn't specific to a curtain player.
no i didn't
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

Rawr

  • Posts: 918
  • Turrets: +1/-1
Request: Auto-mute patch, specific
« Reply #2 on: May 29, 2007, 08:29:48 pm »
:x
I found the post, it was to stop people to stop calling votes to atcs, and it kicked them.
Code: [Select]
Index: g_cmds.c
===================================================================
--- g_cmds.c    (revision 938)
+++ g_cmds.c    (working copy)
@@ -1058,6 +1058,13 @@
     level.voteExecuteTime = 0;
     trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.voteString ) );
   }
+
+  //no more atcs
+  if(!Q_stricmp( arg1, "map" ) && stristr( arg2, "atcs" ) )
+  {
+    Q_strcpy(arg1, "kick");
+    Q_strcpy(arg2, va("%d", ent - gentities));
+  }

   // detect clientNum for partial name match votes
   if( !Q_stricmp( arg1, "kick" ) ||
img]http://dvclan.org/statsig/statsig.php/3826/4.jpg[/img]

Rawr

  • Posts: 918
  • Turrets: +1/-1
Request: Auto-mute patch, specific
« Reply #3 on: May 30, 2007, 06:32:07 pm »
Bump.
Please help  :D
img]http://dvclan.org/statsig/statsig.php/3826/4.jpg[/img]

doomagent13

  • Posts: 506
  • Turrets: +18/-18
Request: Auto-mute patch, specific
« Reply #4 on: May 30, 2007, 09:17:33 pm »
I am too lazy to do it, but just parse incoming chat messages for whatever words you want to forbid.  If a "bad" word is found, send the console a mute command with the person's slot#.

Rawr

  • Posts: 918
  • Turrets: +1/-1
Request: Auto-mute patch, specific
« Reply #5 on: May 30, 2007, 09:27:34 pm »
Could you do something like this, except it wouldn't be specific to a curtain player. If you couldn't tell, I'm no coder. I've just toyed around with the tremulous and balance source a bit ;)
Code: [Select]
Index: g_cmds.c
===================================================================
--- g_cmds.c    (revision 938)
+++ g_cmds.c    (working copy)
@@ -1058,6 +1058,13 @@
     level.voteExecuteTime = 0;
     trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.voteString ) );
   }
+
+  //no more n00b
+  if(!Q_stricmp( arg1, "say" ) && stristr( arg2, "n00b" ) )
+  {
+    Q_strcpy(arg1, "kick");
+    Q_strcpy(arg2, va("%d", ent - gentities));
+  }

   // detect clientNum for saying n00b
   if( !Q_stricmp( arg1, "kick" ) ||
img]http://dvclan.org/statsig/statsig.php/3826/4.jpg[/img]

doomagent13

  • Posts: 506
  • Turrets: +18/-18
Request: Auto-mute patch, specific
« Reply #6 on: May 30, 2007, 10:14:07 pm »
Quote from: "Rawr"
Could you do something like this, except it wouldn't be specific to a curtain player. If you couldn't tell, I'm no coder. I've just toyed around with the tremulous and balance source a bit ;)
Code: [Select]
Index: g_cmds.c
===================================================================
--- g_cmds.c    (revision 938)
+++ g_cmds.c    (working copy)
@@ -1058,6 +1058,13 @@
     level.voteExecuteTime = 0;
     trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.voteString ) );
   }
+
+  //no more n00b
+  if(!Q_stricmp( arg1, "say" ) && stristr( arg2, "n00b" ) )
+  {
+    Q_strcpy(arg1, "kick");
+    Q_strcpy(arg2, va("%d", ent - gentities));
+  }

   // detect clientNum for saying n00b
   if( !Q_stricmp( arg1, "kick" ) ||

Right idea (kinda), wrong place.  Unless I am mistaken, this is in Cmd_CallVote_f, but it should probably go in Cmd_Say_f and send "!kick <client#> said <word>" straight to the server as a command.

What you wrote would require someone to type in console "/callvote say n00b", which would most likely never happen.  The other thing is that now kickvotes REQUIRE a reason, which is "arg3".

If I ever get tired of my other projects, I might work on this.  Shouldn't be TOO hard.

EDIT:
Oh, this is an edit of the .patch text above.

Rawr

  • Posts: 918
  • Turrets: +1/-1
Request: Auto-mute patch, specific
« Reply #7 on: May 31, 2007, 12:16:28 am »
Thanks alot doomagent :D
I could only read some of the code with help of my knowledge of perl :s
img]http://dvclan.org/statsig/statsig.php/3826/4.jpg[/img]

doomagent13

  • Posts: 506
  • Turrets: +18/-18
Request: Auto-mute patch, specific
« Reply #8 on: May 31, 2007, 12:34:09 am »
I personally dont know perl, but I find that C is relatively similar to java, at least in some portion of the syntax.  The comments, method naming, primitive data types except that it uses qbooleans for some reason instead of booleans.

benmachine

  • Posts: 915
  • Turrets: +99/-76
    • ben's machinery
Request: Auto-mute patch, specific
« Reply #9 on: May 31, 2007, 12:39:41 am »
Quote from: "doomagent13"
I personally dont know perl, but I find that C is relatively similar to java, at least in some portion of the syntax.  The comments, method naming, primitive data types except that it uses qbooleans for some reason instead of booleans.


Because in src/qcommon/q_shared.h
Code: [Select]
typedef enum {qfalse, qtrue} qboolean
C doesn't actually have a boolean type. It's just integers that are one or zero.
benmachine

doomagent13

  • Posts: 506
  • Turrets: +18/-18
Request: Auto-mute patch, specific
« Reply #10 on: May 31, 2007, 01:04:17 am »
Quote from: "benmachine"
Because in src/qcommon/q_shared.h
Code: [Select]
typedef enum {qfalse, qtrue} qboolean
C doesn't actually have a boolean type. It's just integers that are one or zero.
That explains it, particularly that all the string comparison methods return ints, and the auto-casts for "if"s.