[HOWTO] Make a nice say-hook
I don't know whether you guys already know this, but I found out how to make a nice, pretty mod-independent say command hook.
As you have probably noticed, doing a CON_COMMAND_F("say", FCVAR_GAMEDLL) makes the original command completly disappear. So, this is what I came up with: Code:
// Special hook for say commands EDIT: Fixed. Forgot m_pGameDLLSayCommand = pPtr; Thanks to u/d/theqizmo for reporting this :D |
nice ! ;)
|
..wow... How over-programmed ..
Here is mine: Code:
CON_COMMAND_F( say, "Hooks say", FCVAR_GAMEDLL ) |
Quote:
|
I like the concept. Like I said I was trying to do this with slot commands but those are apparently done differently. I don't, however, use it for say. The code for the say command is right in the sdk :x.
Code:
const ConVar* mp_teamplay = NULL; |
Heh, I didn't want to copy the SDK code into my plugin - this seems to be far more mod-independent and easier :)
(I also didn't want to use offset hacks) Manip: Like BeetleFart said, you would have to recode the whole say thing in order to dispatch the message to all the clients, like vancelorgin did. |
Quote:
/X |
You underestimate valve. They would readily break API to promote something different (just look at the past).
Mod and engine independence is a huge plus no matter how cool hacked code is ;] |
Quote:
The engine is mod independent, it's the g#d d¤%m engine (:wink:)??!! All HL2DS mods are engine API dependent or otherwise it would NOT be a HL2DS based game!!?? If the engine API would change that much (that the offset "hack" wouldn't work) then you still would have to recompile all mods and server plugins... so what's the difference (except that you would have to re-create a new function pointer struct when using offsets)?? Remember that valve is in the business of getting money from licenses of their engine. If they would change it (the engine API) so it would require recompiles of mods then you would have a lot of unhappy licensors (ie BIG customers). The last engine API changes on HLDS were done to support CS:CZ and it was only new functions appended to the end of the function pointer list... which won't cause a problem when using offsets and should have not been an issue in the past if MetaMod would have been implemented "correctly"... Unless it will relink the objects internal virtual functions at runtime?? BUT again... everyone is, and will, choose their own way to implement their solutions (unless you are on a development team :wink:)... /X |
The offsets, bailo, PM is referring to, are offsets in the Interfaces' virtual function tables - publicly accessible, mod universal, fundamental classes, like XAD said. When you hear 'offset' you instantly think hardcoded address - which is a terrible mistake :P I never hardcode addresses in my projects. Offsets are unnecessary here (in fact I don't see how you'd even be able to squeeze them in somewhere). Besides, the modified standard class / interface method can only be used in rare situations where the plugin is called or given a chance to inject itself somewhere. Vtable hooks can be used anywhere. Just try to overload IVEngineServer without it :/
The 'offset' method XAD and I are using is just as mod universal as the server plugin interface, nay, the engine interface. Unless a mod releases it's own engine binaries, the method will work flawlessly. Though I use this method elsewhere, I prefer mine for say hooking, for the time being, as it allows me to add say text tokens, like @n for name, @l for location, @h for health, etc, and otherwise modify what the client says. Doing that with your method would require somehow overwriting the engine's argument list, which would be, by your standards, ugly ^_^ |
All times are GMT -4. The time now is 06:23. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.