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

Using SourceHook


Post New Thread Reply   
 
Thread Tools Display Modes
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 10-09-2008 , 16:01   Re: Using SourceHook
Reply With Quote #11

its a vsp..

Im trying to find the lastest single version of sourcehook.
to learn this on.
Ill check out the PLUGIN_SAVEVARS() macro in ISmmPlugin.h
__________________
CSource Server:
69.90.34.10:27015 Beetlesmod.com And CS-Addicts{US}



http://www.clanuseast.com
BeetleFart is offline
pRED*
Join Date: Dec 2006
Old 10-09-2008 , 16:03   Re: Using SourceHook
Reply With Quote #12

PLUGIN_SAVEVARS() relies on the metamod load forward to get all the pointers, which you won't have.

Have you followed the embedding SourceHook bit at the bottom of that wiki page?
pRED* is offline
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 10-09-2008 , 16:11   Re: Using SourceHook
Reply With Quote #13

Thats where I'll start ...thanks for the pointer in the right direction.
__________________
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 10-09-2008 , 16:32   Re: Using SourceHook
Reply With Quote #14

where can I download the latest versions of sourcehook...I may have 2 different versions and its not helping matters.
__________________
CSource Server:
69.90.34.10:27015 Beetlesmod.com And CS-Addicts{US}



http://www.clanuseast.com
BeetleFart is offline
pRED*
Join Date: Dec 2006
Old 10-09-2008 , 16:40   Re: Using SourceHook
Reply With Quote #15

http://hg.alliedmods.net/mmsource-ce...35/sourcehook/

Click one of the bz2/zip links or use mercurial to check out a copy.
pRED* is offline
BAILOPAN
Join Date: Jan 2004
Old 10-09-2008 , 16:53   Re: Using SourceHook
Reply With Quote #16

You should really consider using MM:S, conflicting copies of SourceHook in the same address space is really problematic. ESTools does this and it causes conflicts with SourceMod.

One thing to do is what Mani does. VSP version with SourceHook embedded, MM:S version without. This works pretty nicely as the API stays the same.

The whole point of SourceHook is to unify hooking (making it easier through macros is just a side effect). If there's multiple SourceHooks, the original purpose is lost
__________________
egg
BAILOPAN is offline
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 10-09-2008 , 18:29   Re: Using SourceHook
Reply With Quote #17

Id love to be able to do it that way..
Im still learning alot of this stuff and I dont know if the sourcehook files I have are mixed versions or not..
I have ones that Ive downloaded or have bits and pieces of from other plugins..
At the very least it would be great to get sourcehook going...then once thats working and I (hopefully) better understand its use then I can think about going full mm...but for now I having issues just to get the simple logprint hook to work. So until thats working correctly for me.....
__________________
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 10-10-2008 , 09:32   Re: Using SourceHook
Reply With Quote #18

I've had no luck at all getting sourcehook to not crash.

I tried it in both my orangebox version and non orangebox versions.
I followed the embedding portion on http://wiki.alliedmods.net/SourceHook_Development
without any luck.
I included the files ..everything compiles fine.
I try just to hook logprint and as soon as I give it a
int log_hook = SH_ADD_HOOK(IVEngineServer, LogPrint, engine, SH_STATIC(Hook_LogPrint), false);
command it crashs.
__________________
CSource Server:
69.90.34.10:27015 Beetlesmod.com And CS-Addicts{US}



http://www.clanuseast.com
BeetleFart is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 10-10-2008 , 17:14   Re: Using SourceHook
Reply With Quote #19

With what error? Maybe a call stack would help. Is g_SHPtr valid? Is engine valid? Also make sure g_PLID doesn't change (though that wouldn't crash).

When it crashes on AddHook, it might mean:
1) g_SHPtr is not a valid pointer to a CSourceHookImpl instance
2) Dereferencing the virtual table and the function entry failed. This could be the passed interface pointer not actually being of the same type as the class used for SH_DECL_HOOK
3) If something went wrong it could be a memory access error (vtables are read-only memory, SourceHook uses VirtualProtect to make it read-write, this might fail on some (security) systems).
4) Something I didn't think of at the moment went wrong.
__________________
hello, i am pm
PM is offline
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 10-10-2008 , 21:33   Re: Using SourceHook
Reply With Quote #20

Thanks ..it was g_SHPtr...I mistakenly defined a local copy so the global didnt get set.
Now back to trying to trap the ivoiceserver.
Thanks
__________________
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 18:16.


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