Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-----------------------------------------------------------------------------
- // SourceHook
- //-----------------------------------------------------------------------------
- using namespace SourceHook;
- Impl::CSourceHookImpl g_SourceHook;
- ISourceHook *g_SHPtr = &g_SourceHook;
- int g_PLID = 0;
- SH_DECL_HOOK1_void(IBaseClientDLL, FrameStageNotify, SH_NOATTRIB, 0, ClientFrameStage_t);
- //-----------------------------------------------------------------------------
- //
- //-----------------------------------------------------------------------------
- bool CServerPlugin::Load( CreateInterfaceFn pfnEngineFactory, CreateInterfaceFn pfnGameFactory )
- {
- ...
- CSysModule *pClientModule = g_pFullFileSystem->LoadModule("bin/client.dll", "MOD", false);
- if(!pClientModule)
- {
- Warning("Unable to find client DLL module (are you on a dedicated server?)\n");
- return false;
- }
- CreateInterfaceFn pfnClientFactory = Sys_GetFactory(pClientModule);
- if(!pfnClientFactory)
- {
- Warning("Unable to retrieve client factory\n");
- return false;
- }
- g_pClient = UTIL_LoadInterface<IBaseClientDLL>(pfnClientFactory, CLIENT_DLL_INTERFACE_VERSION, bSuccess);
- // Initialize hooks
- SH_ADD_HOOK(IBaseClientDLL, FrameStageNotify, g_pClient, SH_MEMBER(&s_ClientPlugin, &CClientPlugin::FrameStageNotify), true);
- }
- //-----------------------------------------------------------------------------
- //
- //-----------------------------------------------------------------------------
- void CServerPlugin::Unload( void )
- {
- ...
- // Remove hooks
- SH_REMOVE_HOOK(IBaseClientDLL, FrameStageNotify, g_pClient, SH_MEMBER(&s_ClientPlugin, &CClientPlugin::FrameStageNotify), true);
- }
- //-----------------------------------------------------------------------------
- //
- //-----------------------------------------------------------------------------
- void CClientPlugin::FrameStageNotify( ClientFrameStage_t curStage )
- {
- // Do your code here
- }
Advertisement
Add Comment
Please, Sign In to add comment