diff --git a/reapi/extra/amxmodx/scripting/include/reapi_engine_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_engine_const.inc index 2302d05b..cfeb1a78 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_engine_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_engine_const.inc @@ -183,6 +183,12 @@ enum EngineFunc * Params: (const cmd[], source, id) */ RH_ExecuteServerStringCmd, + + /* + * Description: Called when server sends resources list and location. + * Params: () + */ + RH_SV_SendResources, }; diff --git a/reapi/include/cssdk/engine/rehlds_api.h b/reapi/include/cssdk/engine/rehlds_api.h index 3e2b4ecc..28f41a1d 100644 --- a/reapi/include/cssdk/engine/rehlds_api.h +++ b/reapi/include/cssdk/engine/rehlds_api.h @@ -258,6 +258,10 @@ typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_ClientPrintf typedef IHookChain IRehldsHook_SV_AllowPhysent; typedef IHookChainRegistry IRehldsHookRegistry_SV_AllowPhysent; +//SV_SendResources hook +typedef IVoidHookChain IRehldsHook_SV_SendResources; +typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_SendResources; + class IRehldsHookchains { public: virtual ~IRehldsHookchains() { } @@ -317,6 +321,7 @@ class IRehldsHookchains { virtual IRehldsHookRegistry_SV_AddResource* SV_AddResource() = 0; virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf() = 0; virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent() = 0; + virtual IRehldsHookRegistry_SV_SendResources* SV_SendResources() = 0; }; struct RehldsFuncs_t { diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index 669ea8ed..6f1effcd 100644 --- a/reapi/src/hook_callback.cpp +++ b/reapi/src/hook_callback.cpp @@ -242,6 +242,16 @@ void ExecuteServerStringCmd(IRehldsHook_ExecuteServerStringCmd* chain, const cha callVoidForward(RH_ExecuteServerStringCmd, original, cmdName, cmdSrc, cmdSrc == src_client ? cl->GetId() + 1 : AMX_NULLENT); } +void SV_SendResources(IRehldsHook_SV_SendResources* chain, sizebuf_t *msg) +{ + auto original = [chain](sizebuf_t *_msg) + { + chain->callNext(_msg); + }; + + callVoidForward(RH_SV_SendResources, original, msg); +} + /* * ReGameDLL functions */ diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index ede4ad76..badc7e64 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -370,6 +370,7 @@ void Con_Printf(IRehldsHook_Con_Printf *chain, const char *string); int PF_precache_generic_I(IRehldsHook_PF_precache_generic_I *chain, const char *s); int PF_precache_model_I(IRehldsHook_PF_precache_model_I *chain, char *s); int PF_precache_sound_I(IRehldsHook_PF_precache_sound_I *chain, const char *s); +void SV_SendResources(IRehldsHook_SV_SendResources *chain, sizebuf_t *msg); struct EventPrecache_args_t { diff --git a/reapi/src/hook_list.cpp b/reapi/src/hook_list.cpp index 8f5bf54a..8a3b134f 100644 --- a/reapi/src/hook_list.cpp +++ b/reapi/src/hook_list.cpp @@ -108,6 +108,7 @@ hook_t hooklist_engine[] = { ENG(SV_ClientPrintf), ENG(SV_AllowPhysent), ENG(ExecuteServerStringCmd), + ENG(SV_SendResources), }; diff --git a/reapi/src/hook_list.h b/reapi/src/hook_list.h index 6e6d9da7..eb73ee6e 100644 --- a/reapi/src/hook_list.h +++ b/reapi/src/hook_list.h @@ -117,6 +117,7 @@ enum EngineFunc RH_SV_ClientPrintf, RH_SV_AllowPhysent, RH_ExecuteServerStringCmd, + RH_SV_SendResources, // [...] };