Monthly Target: $400 Donations: $72
 18% 

Using SourceHook


Post New Thread Reply   
 
Thread Tools Display Modes
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 11-06-2008 , 14:07   Re: Using SourceHook
Reply With Quote #21

Im now trying to hook
the WeaponCanUse virtual function

SH_DECL_MANUALHOOK1(WeaponCanUseHook, 0, 0, 0, bool, CBaseCombatWeapon *);
declared globally

i added into clientactive:

int Offset=216;
SH_MANUALHOOK_RECONFIGURE(WeaponCanUseHook, Offset, 0, 0);
SH_ADD_MANUALHOOK_MEMFUNC(WeaponCanUseHook, pBase, &g_EmtpyServerPlugin, &CEmptyServerPlugin::WeaponCanUseFunction, false);

and have:
bool CEmptyServerPlugin::WeaponCanUseFunction(CBas eCombatWeapon *pWeapon)
{
RETURN_META_VALUE(MRES_IGNORED, false);
}

and it appears to hook etc...but when the WeaponCanUseFunction is called
it comes up with and ESP problem with parameters not being stored correctly across the function call and Dont know what Im doing wrong.
I want to hook if someone can use a specific weapon .
What am I doing incorrectly?
__________________
CSource Server:
69.90.34.10:27015 Beetlesmod.com And CS-Addicts{US}



http://www.clanuseast.com
BeetleFart is offline
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 11-06-2008 , 15:23   Re: Using SourceHook
Reply With Quote #22

Im not sure what I did..but I redid it and now it seems to be working correctly.
Not sure what was wrong..maybe I had the offset wrong or something
__________________
CSource Server:
69.90.34.10:27015 Beetlesmod.com And CS-Addicts{US}



http://www.clanuseast.com
BeetleFart is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 11-07-2008 , 11:13   Re: Using SourceHook
Reply With Quote #23

Yes, I've had that error when I have the wrong offset or if the function parameters or call type are defined wrong.
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 01-07-2009 , 11:52   Re: Using SourceHook
Reply With Quote #24

Does anyone know if theres something I need to do with sourcehook and linux.
Ive added a soucehook into the g_VoiceServer to trap the voice comms
and it works great in windows. I have one linux box that its being tested on
and when I do the sh_add_hook_memfunc it returns a 1 (or number of times Ive hooked it)
but the OnSetClientListening function never gets called on the linux box.
I would think that if the return value was ok..like it appears to be ..that the
hook is in place..or is the return value of 1 when I hook it once incorrect?
__________________
CSource Server:
69.90.34.10:27015 Beetlesmod.com And CS-Addicts{US}



http://www.clanuseast.com
BeetleFart is offline
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 01-08-2009 , 12:40   Re: Using SourceHook
Reply With Quote #25

anyone know why a hook would work in windows but not in linux???
__________________
CSource Server:
69.90.34.10:27015 Beetlesmod.com And CS-Addicts{US}



http://www.clanuseast.com
BeetleFart 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 22:12.


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