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

Hooking every entity


Post New Thread Reply   
 
Thread Tools Display Modes
sslice
Senior Member
Join Date: Feb 2005
Location: Texas, USA
Old 05-13-2007 , 13:57   Re: Hooking every entity
Reply With Quote #11

There's always the 'player_spawn' game event, lol.

You could also try hooking IVEngineServer::CreateEdict.
__________________
sslice is offline
Drunken F00l
Member
Join Date: May 2007
Old 05-13-2007 , 13:59   Re: Hooking every entity
Reply With Quote #12

Hooking CreateEdict doesn't work because the edict is created before the CBE networkable. I used to use this though and then just hook the CBE next frame. If I do that though, I miss all of the KeyValue calls .
Drunken F00l is offline
sslice
Senior Member
Join Date: Feb 2005
Location: Texas, USA
Old 05-13-2007 , 14:08   Re: Hooking every entity
Reply With Quote #13

Just curious... what do you need the KeyValues for?
__________________
sslice is offline
Drunken F00l
Member
Join Date: May 2007
Old 05-13-2007 , 14:09   Re: Hooking every entity
Reply With Quote #14

+copyent
Drunken F00l is offline
cybermind
Senior Member
Join Date: Oct 2004
Old 05-15-2007 , 17:41   Re: Hooking every entity
Reply With Quote #15

Quote:
Originally Posted by bailopan
Actually, one really hacky possibility is to change the return address on the stack with a pre-detour, then when the function returns, it returns to a second post detour, where you can do your thing and then jump to the original return address.
That would be require your hook installation code running at the same time as the target function (or called from it) since that's all done during run-time as opposed to load-time. So you'd already need another hooking mechanism to do this. Interesting method for executing code in a remote process though...

Last edited by cybermind; 05-15-2007 at 17:49.
cybermind is offline
Fredd
Veteran Member
Join Date: Jul 2007
Old 05-08-2008 , 12:10   Re: Hooking every entity
Reply With Quote #16

Drunken F00l@: have you ever got this working, im very interested in this and i have been looking for something like this rather than then you using a hassle entity listener...
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!
Fredd is offline
Drunken F00l
Member
Join Date: May 2007
Old 05-08-2008 , 13:23   Re: Hooking every entity
Reply With Quote #17

Yes, I did get this working eventually but then decided I didn't need to use the system anyways.

Basically, I ran through every entity in the entity dictionary. I made one of each (except for a few exceptions like "player") and then made a DVP hook to the function I wanted hooked on every entity.

Another possibility is to hook the dictionary's create function and hook each entity as it's created. I've never tried it, but it might work for you.
Drunken F00l is offline
Fredd
Veteran Member
Join Date: Jul 2007
Old 05-09-2008 , 01:07   Re: Hooking every entity
Reply With Quote #18

ok a few things, the EntityFactoryDictionary doesnt seem to have the function from what i was, but when i scrolled down i saw a IEntityFactory class with the following functions
Quote:
virtual IServerNetworkable *Create( const char *pClassName ) = 0;
virtual void Destroy( IServerNetworkable *pNetworkable ) = 0;
if this is is the class you are talking about, first how do i hook these functions do i need to use "GET_V_IFACE_*" or something to get the pointer of the class and then use "SH_ADD_HOOK_MEMFUNC" just like when hooking anything in the standard interfaces? and second if this were to work or something would i only be able to hook networkable entities? because i was kinda of planning to hook like everything in the game..

thanks,
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!
Fredd is offline
Drunken F00l
Member
Join Date: May 2007
Old 05-09-2008 , 12:44   Re: Hooking every entity
Reply With Quote #19

Ya, you could hook Create on every entity factory and then hook each enitity that gets created. I've never done that, but it could work. Hook it like you would as if it were any other interface. Make it a post hook so that you can then hook the return value (the newly created entity).

Also, I'm not sure if it would limit you to networked entities or not. I suppose you could try it and find out.
Drunken F00l is offline
Reply



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 21:49.


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