Raised This Month: $51 Target: $400
 12% 

A question for the guru(s)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nimgoble
Junior Member
Join Date: Apr 2006
Old 07-02-2008 , 19:51   A question for the guru(s)
Reply With Quote #1

Why hello there. I am currently making a plugin for HL2DM and I have a couple of questions.

1. Is 1.6.1 of sourcehook compatible with HL2DM? I see on the download section that it suggests we use 1.4.3 for HL2DM.

The reason I ask is because I need global hooks, I believe. I'll tell you my dillema and let you tell me what you would do.

I need to change the grenades think function. In HL2DM, when a player throws a grenade, it calls "Fraggrenade_Create". I need to get a pointer to the grenade that is created, so I can set it's think function. Now, I've been hooking virtual calls this whole time, because I wish to avoid having to look up signatures. So, I followed "Fraggrenade_Create" all the way down to a function I could hook:
virtual IEntityFactory::IServerNetworkable *Create( const char *pClassName ) = 0;

It's WAY down the line, but it'll do. Now, assuming I can get the entity factory, which I think I can, all I would have to do is get a pointer to the IServerNetworkable that it is creating. I would be able to( I think ) forego a global hook in favor of this. In fact, I would prefer it.

So, after all that: How do I get a pointer to that entity that is created?

I also have to do this same thing with crossbow bolts. I have to change the velocity.

Thanks much for your help.
Nimgoble is offline
BAILOPAN
Join Date: Jan 2004
Old 07-02-2008 , 23:53   Re: A question for the guru(s)
Reply With Quote #2

Unfortunately no, we don't package SHv5 with MM:S 1.6, because it's not binary compatible. After CS:S gets ported to Orange Box we may start releasing MM:S 1.6 for the original engine -- right now we don't want any support nightmares.

Note: SH is a drop-in replacement, you can always throw it onto MM:S 1.4.3 and rebuild it with almost no changes, but your plugin will not be loadable by anyone running the official 1.4.x.

If you manage to hook that virtual call, it's easy -- hook it in post, then call META_RESULT_ORIG_RET().
__________________
egg
BAILOPAN is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 07-03-2008 , 10:46   Re: A question for the guru(s)
Reply With Quote #3

Why would you go backwards and release 1.6 for the original engine (EP1)?

They are working on HL2DM for orange box now, as well as CS:S. I don't think there would be a need to make it compatible with the original engine unless you are doing it for mods that won't be upgraded.
Keeper is offline
BAILOPAN
Join Date: Jan 2004
Old 07-03-2008 , 11:39   Re: A question for the guru(s)
Reply With Quote #4

"unless you are doing it for mods that won't be upgraded"

Bingo ;)

But we'll make that judgment call when the time comes.
__________________
egg
BAILOPAN is offline
voogru
Inspector Javert
Join Date: Oct 2004
Old 07-03-2008 , 11:58   Re: A question for the guru(s)
Reply With Quote #5

You got the right idea hooking the entity factory create, just make sure you make it a POST call.


Code:
IServerNetworkable *CFortressAdmin :: EntityFactoryCreate_Post( const char *pClassName )
{
	if(!pClassName)
		RETURN_META_VALUE(MRES_IGNORED, NULL);

	IServerNetworkable *pNetworkable = META_RESULT_ORIG_RET(IServerNetworkable *);

	if(pNetworkable && m_bHandleEntities) 
	{
		CEntity *pCEntity = CEntity::HandleEntity(pClassName, g_Util.ToEdict(pNetworkable->GetBaseEntity()) );

		if(pCEntity) {
			pCEntity->Spawn();
		}
	}
	RETURN_META_VALUE(MRES_IGNORED, pNetworkable);
}
voogru is offline
Nimgoble
Junior Member
Join Date: Apr 2006
Old 07-03-2008 , 12:56   Re: A question for the guru(s)
Reply With Quote #6

voogru, how did you go about actually hooking the entity factory, though? I can't seem to find an interface version anywhere...

You wouldn't have happened to have used a global hook, would you?

Last edited by Nimgoble; 07-03-2008 at 13:06.
Nimgoble is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 07-03-2008 , 13:22   Re: A question for the guru(s)
Reply With Quote #7

As far as I know, you'll need to sig scan to find the interface factory.
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
Nimgoble
Junior Member
Join Date: Apr 2006
Old 07-03-2008 , 13:47   Re: A question for the guru(s)
Reply With Quote #8

DAMN
Nimgoble is offline
Fredd
Veteran Member
Join Date: Jul 2007
Old 07-17-2008 , 19:11   Re: A question for the guru(s)
Reply With Quote #9

yeah i have tried it and it works fine the sig address is actually in one of the sourcemod gamedata files.
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!
Fredd 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 13:52.


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