Tremulous Forum
Mods => Modding Center => Topic started by: Rawr 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.
-
I know kevlarman wrote something like this, only it wasn't specific to a curtain player.
no i didn't
-
:x
I found the post, it was to stop people to stop calling votes to atcs, and it kicked them.
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" ) ||
-
Bump.
Please help :D
-
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#.
-
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 ;)
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" ) ||
-
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 ;)
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.
-
Thanks alot doomagent :D
I could only read some of the code with help of my knowledge of perl :s
-
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.
-
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
typedef enum {qfalse, qtrue} qboolean
C doesn't actually have a boolean type. It's just integers that are one or zero.
-
Because in src/qcommon/q_shared.h
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.