Server Help

ASSS Custom Projects - chatmenu

Smong - Wed Jul 26, 2006 8:03 pm
Post subject: chatmenu
This is the module behind the menu system in my Pirates! zone. It doesn't do anything on its own but makes it easier for other modules to start chat based votes and stuff (often used in elim-like events).

I'm not providing binaries because as I said before it's no good on it's own so anyone that wants this should already be able to compile from source.

This is also the patch I use to prevent pub chat getting spammed with numbers:
Code: Show/Hide
--- core/chat.c   2006-06-08 23:41:24.000000000 +0100
+++ new/chat1.c   2006-07-03 20:30:16.000000000 +0100
@@ -1,3 +1,8 @@
+/* chat1
+ *
+ * modified to filter out lines in pub chat with just a number in them. smong.
+ *
+ */

/* dist: public */

@@ -441,7 +446,11 @@
      int type = ismacro ? MSG_PUBMACRO : MSG_PUB;
      LinkedList set = LL_INITIALIZER;
      get_arena_set(&set, arena, p);
-      send_reply(&set, type, sound, p, p->pid, msg, 0);
+
+      /* hack: eat integers between 1 and 9 inclusive */
+      if (msg[1] != 0 || *msg < '1' || *msg > '9')
+         send_reply(&set, type, sound, p, p->pid, msg, 0);
+      
      DO_CBS(CB_CHATMSG, arena, ChatMsgFunc, (p, type, sound, NULL, -1, msg));
      lm->LogP(L_DRIVEL, "chat", p, "pub msg: %s", msg);
   }
@@ -879,7 +888,7 @@
};


-EXPORT int MM_chat(int action, Imodman *mm_, Arena *arena)
+EXPORT int MM_chat1(int action, Imodman *mm_, Arena *arena)
{
   if (action == MM_LOAD)
   {

Smong - Fri Jul 28, 2006 12:14 pm
Post subject:
I have attached an example module called cm_tkmenu. Should you get tk'd it will ask you if you want to forgive them or punish them. The punishment is engine shutdown and energy depletion.
Dr Brain - Fri Jul 28, 2006 12:17 pm
Post subject:
If you haven't been asked a question, will it still stop numbers from going into pub chat?
Smong - Fri Jul 28, 2006 12:23 pm
Post subject:
The patch to chat.c will stop single digit numbers being forwarded to everyone else.

Edit: Er, with the patch it always filters, there's no communication between chat and chatmenu to toggle the filtering on/off.
Grelminar - Sat Jul 29, 2006 1:45 am
Post subject:
Yeah, something along those lines would be what I would want if I wanted to merge this.

Maybe a new Ichat function AskQuestion(player, text, callback, clos), which would send one or more lines of chat (split on newlines), then take the next line of pub chat from the player that consisted of just a number, and pass that number to the callback function. Numbers wouldn't be filtered out normally, and only from pub chat.
Elnino - Thu Aug 17, 2006 2:00 pm
Post subject:
whoa that's a GREAT module

simple, effective and fun good job Smong
Animate Dreams - Fri Aug 18, 2006 3:11 pm
Post subject:
I just had an amazing idea. Filtering out duplicate macros. Or maybe every macro past the 2nd. Really, it should be an option in global.conf.
Bak - Fri Aug 18, 2006 3:38 pm
Post subject:
or you could just put it in the client itself, that way everyone could have their own setting... maybe even make it accessable with a quick keyboard shortcut like ESC + I or something... that'd be the day
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group