Raised This Month: $ Target: $400
 0% 

Using SourceHook


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pRED*
Join Date: Dec 2006
Old 10-08-2008 , 19:14   Re: Using SourceHook
Reply With Quote #1

Thought that sounded too easy.

One of the pointers you are passing maybe?
g_pVoiceServer?
pRED* is offline
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 10-08-2008 , 22:23   Re: Using SourceHook
Reply With Quote #2

i verified its not null ...
and its appears good in :Load
__________________
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 , 13:38   Re: Using SourceHook
Reply With Quote #3

When I Call the SH_ADD_HOOK_MEMFUNC(IVoiceServer, SetClientListening, g_pVoiceServer,&g_EmtpyServerPlugin,&CEmptySe rverPlugin::OnSetClientListening, false);

g_pVoiceServer is valid, g_EmptyServerPlugin is My main plugin class
and is valid as well..
I still dont see why it crashs...
with a breakpoint on SH_DECL_HOOK3
it appears to be hooking in ...i see it going thru the macro's etc for fastdelegate etc..
but 3rd time it goes thru sh_decl_hook3 it crashs

does the class that I pass in for handler_inst have to be derived from a specific class or something?
__________________
CSource Server:
69.90.34.10:27015 Beetlesmod.com And CS-Addicts{US}



http://www.clanuseast.com

Last edited by BeetleFart; 10-09-2008 at 13:42.
BeetleFart is offline
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 10-09-2008 , 15:41   Re: Using SourceHook
Reply With Quote #4

The problem is with my not initializing source hook variable
SourceHook::ISourceHook *g_SHPtr

How do I initialize sourcehook correctly.
Im trying to follow the wiki at
http://wiki.alliedmods.net/SourceHoo...t#Simple_Hooks
but Im not having much luck.
__________________
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 , 15:59   Re: Using SourceHook
Reply With Quote #5

Is this a metamod plugin or a VSP?

The embedding section on that wiki page suggests that multiple versions of sourcehook in the same process will probably conflict, so not entirely sure how you'd add it to a VSP if metamod is running.

If it's metamod you need something like this in your metamod load function:

g_SHPtr = static_cast<SourceHook::ISourceHook *>(ismm->MetaFactory(MMIFACE_SOURCEHOOK, NULL, NULL));
g_PLID = id;

or look at the PLUGIN_SAVEVARS() macro in ISmmPlugin.h
pRED* is offline
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 10-09-2008 , 16:01   Re: Using SourceHook
Reply With Quote #6

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 #7

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
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 18:40.


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