diff --git a/sourcemm/stub_mm/stub_mm.cpp b/sourcemm/stub_mm/stub_mm.cpp index a093b05..bc5c19d 100644 --- a/sourcemm/stub_mm/stub_mm.cpp +++ b/sourcemm/stub_mm/stub_mm.cpp @@ -18,7 +18,7 @@ PLUGIN_EXPOSE(SamplePlugin, g_StubPlugin); //This has all of the necessary hook declarations. Read it! #include "meta_hooks.h" -void StubPlugin::ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) +void ServerActivate_handler(edict_t *pEdictList, int edictCount, int clientMax) { META_LOG(g_PLAPI, "ServerActivate() called: edictCount=%d, clientMax=%d", edictCount, clientMax); RETURN_META(MRES_IGNORED); @@ -36,18 +36,14 @@ bool StubPlugin::Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, return false; } - SH_ADD_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, m_ServerDll, &g_StubPlugin, ServerActivate, true); - - m_ServerDll_CC = SH_GET_CALLCLASS(IServerGameDLL, m_ServerDll); + SH_ADD_HOOK_STATICFUNC(IServerGameDLL, ServerActivate, m_ServerDll, ServerActivate_handler, true); return true; } bool StubPlugin::Unload(char *error, size_t maxlen) { - SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, m_ServerDll, &g_StubPlugin, ServerActivate, true); - - SH_RELEASE_CALLCLASS(m_ServerDll_CC); + SH_REMOVE_HOOK_STATICFUNC(IServerGameDLL, ServerActivate, m_ServerDll, ServerActivate_handler, true); return true; } diff --git a/sourcemm/stub_mm/stub_mm.h b/sourcemm/stub_mm/stub_mm.h index c829802..d377115 100644 --- a/sourcemm/stub_mm/stub_mm.h +++ b/sourcemm/stub_mm/stub_mm.h @@ -30,9 +30,6 @@ public: const char *GetVersion(); const char *GetDate(); const char *GetLogTag(); -public: - //Called on ServerActivate. Same definition as server plugins - void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax); private: IServerGameDLL *m_ServerDll; IServerGameDLL *m_ServerDll_CC; @@ -42,4 +39,7 @@ extern StubPlugin g_StubPlugin; PLUGIN_GLOBALVARS(); +//Called on ServerActivate. Same definition as server plugins +void ServerActivate_handler(edict_t *pEdictList, int edictCount, int clientMax); + #endif //_INCLUDE_SAMPLEPLUGIN_H