Raised This Month: $32 Target: $400
 8% 

[TF2] SM Extension Questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lange
Member
Join Date: Apr 2009
Old 04-15-2014 , 12:49   [TF2] SM Extension Questions
Reply With Quote #1

Hi,

I've got a lot of experience making SM Plugins, but I'm new to extensions. The reason I want to make an extension is partly curiosity, and partly frustration with the syntax and structure of the SourcePawn language.

One of the first hurdles I'm struggling with is how to best hook the chat event. I've managed to successfully do so by creating an IGameEventListener2 instance in my extension, but this seems redundant given that SM surely is already hooking this event somewhere else. I've pored over the C++ Reference, but have yet to find an interface exposed to extensions for the chat event(s).

So my questions is: what is the best way to hook the chat (player_say) event with a Sourcemod Extension? Better yet, how can I replicate the functionality of RegConsoleCmd() in an extension?

Thanks,
Lange

Last edited by Lange; 04-15-2014 at 12:51.
Lange is offline
donrevan
AlliedModders Donor
Join Date: Jul 2010
Old 04-15-2014 , 13:05   Re: [TF2] SM Extension Questions
Reply With Quote #2

Extensions are designed to extend the functionality of the SM core. SM doesn't provide chat message hooks or similar for extensions, you've to do it on your own.

I highly suggest to use plugins instead of a extension for such purposes.
You should only use the extension system if you've a large codebase already written in C/C++ or you cannot do certain things in SourcePawn.

Back2topic: Hooking player_say is fine for chat messages. You've to use SourceHook to get access to console command listening I think.

Last edited by donrevan; 04-15-2014 at 13:05.
donrevan is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:20.


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