Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!
Most of the plugins here are made by B3 users and the authors may not visit frequently. If you need support for plugins or if questions remain unanswered, you will have to contact the author directly. Read the full Support Disclaimer here

NOTE: Do not attach plugins to your forumtopics! Attachements are periodically removed by maintenance tasks. Upload your plugins to our Downloads section instead!

Author Topic: Modifying user messages  (Read 818 times)

Offline gac

  • Newbie
  • *
  • Posts: 5
Modifying user messages
« on: September 30, 2016, 12:30:21 AM »
Hi,

I've looked trough all 10 pages of this section and search on google a lot but I wasn't able to find any solution to my problem. This is what I have so far:

  • I've downloaded the mute plugin from this forum from user Spoon
  • Modified it so the mute is permanent and log is to the db

But what I need do now is try and like hide the massage from the muted players. Like if they try to write something the message would either appear as empty or replaced with several *** characters. Is there a way to do this in b3 ?
Code: [Select]
          def onEvent(self, event):
if event.type == b3.events.EVT_CLIENT_AUTH:
cursor = self.console.storage.query("SELECT * FROM muted_players WHERE client_id = '%s'" % event.client.cid)
r = cursor.getRow()
if cursor.rowcount > 0:
muted = r['muted']
event.client.setvar(self, 'muted', muted)
else:
event.client.setvar(self, 'muted', 0)
if event.type == b3.events.EVT_CLIENT_SAY or event.type == b3.events.EVT_CLIENT_TEAM_SAY:
if event.client.var(self, 'muted', 0).value == 1:
self._adminPlugin.warnClient(event.client, 'You are not allowed to talk', None, False, '', 1)
else:
return False


This is my onEvent code, as I believe this is where I should replace/filter that message (am I correct ? ).
If you need anything else just ask for. :)
« Last Edit: September 30, 2016, 12:32:06 AM by gac »

Offline 82ndAB.Bravo17

  • Dev. Team
  • Hero Member
  • *
  • Posts: 2527
Re: Modifying user messages
« Reply #1 on: September 30, 2016, 03:54:36 PM »
I'm afraid that that can't be done by B3, it is a function of the game engine that shows the chat on screen. B3 can only respond once the chat has been written to the game log, at which point the game has already shown it.

Offline gac

  • Newbie
  • *
  • Posts: 5
Re: Modifying user messages
« Reply #2 on: September 30, 2016, 11:34:18 PM »
Thank you for your response. I saw a few servers where they did something and if I wrote something forbidden it would be replace with ***. Does that mean they recompiled some part of the engine or edited some .gsc files. If so, could you point me in the right direction.

Thank you and kind regards,
Gac :)
« Last Edit: October 01, 2016, 12:55:07 PM by gac »

Offline 82ndAB.Bravo17

  • Dev. Team
  • Hero Member
  • *
  • Posts: 2527
Re: Modifying user messages
« Reply #3 on: September 30, 2016, 11:54:01 PM »
That depends what game it is.

Offline gac

  • Newbie
  • *
  • Posts: 5
Re: Modifying user messages
« Reply #4 on: October 01, 2016, 12:51:50 PM »
I'm running cod4 server with codx 1.8 on it.

Offline 82ndAB.Bravo17

  • Dev. Team
  • Hero Member
  • *
  • Posts: 2527
Re: Modifying user messages
« Reply #5 on: October 01, 2016, 04:46:03 PM »
You probably need to ask the question on a COD4 modding forum then.

 


Rate this page +1 at Google Search

anything