AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Catching successfully sent client messages (https://forums.alliedmods.net/showthread.php?t=319927)

thEsp 11-26-2019 15:15

Catching successfully sent client messages
 
Hi,

I am developing a plugin that reads messages sent from Discord. I successfully did this but now I have another task to do: send in-game client ("say", "amx_say") messages to Discord. That's easy but not before knowing how to catch successfully sent messages. What I mean by this is simple, there are tons of plugins that block messages in a certain moment (i.e Gag system), so how do I detect a sent message if hooking say command is unsafe? Is SayText event safe despite not being used well (I've seen many scripts ignoring its arguments)?

- Thanks, thEsp.

georgik57 11-26-2019 16:13

Re: Catching successfully sent client messages
 
Just make sure your plug-in is listed first if you want it to catch all messages or last if you want it to catch only non-blocked ones.

Bugsy 11-26-2019 18:03

Re: Catching successfully sent client messages
 
I don't get what you're asking. You want to block chat messages in CS? If so, hook SayText and return PLUGIN_HANDLED to block.

thEsp 11-26-2019 18:59

Re: Catching successfully sent client messages
 
No Bugsy, I want to catch exactly what you said: if PLUGIN_HANDLED has been returned in say command or not. I think Georgik's idea might work, I'll try tomorrow and give a feedback.

Bugsy 11-26-2019 21:34

Re: Catching successfully sent client messages
 
Ok, yeah put it towards the top of plugins.ini

Natsheh 11-27-2019 15:55

Re: Catching successfully sent client messages
 
try using register_event("SayText", "Event_SayText", "b"); instead of hooking say & say_team using register_clcmd, to not catch blocked messages...

thEsp 11-27-2019 16:12

Re: Catching successfully sent client messages
 
How safe is it tho, isn't it called when used by different stocks(i.e colorchat)? I've did what I was told by Georgik, seems to bee the definitive solution.

Bugsy 11-27-2019 18:36

Re: Catching successfully sent client messages
 
Natsheh, I think it depends on which plugin the message flows through first, right? I think what you mention is the obvious, but if you hook it after other plugins already 'saw' it, it's not a true block. OP, is this what you're trying to avoid? thEsp, best bet is to try it and see if it does what you want.


All times are GMT -4. The time now is 15:28.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.