diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc index 03621e61..41b3d986 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -487,6 +487,12 @@ enum GamedllFunc * Params: (const pPlayer, iSlot) */ RG_BuyItem, + + /* + * Description: Called when a player sends a chat message (say or say_team) + * Params: (const pPlayer, bool:teamonly, const text[], const pszFormat[], const pszConsoleFormat[], bool:bSenderDead, const placeName[], bool:consoleUsed) + */ + RG_Host_Say, }; /** diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h index 62273fe6..89dc74dd 100644 --- a/reapi/include/cssdk/dlls/regamedll_api.h +++ b/reapi/include/cssdk/dlls/regamedll_api.h @@ -638,6 +638,10 @@ typedef IHookChainRegistryClass IReGameHookRegistry_CBa typedef IHookChainClass IReGameHook_CBasePlayer_TakeDamageImpulse; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_TakeDamageImpulse; +// Host_Say hook +typedef IHookChain IReGameHook_Host_Say; +typedef IHookChainRegistry IReGameHookRegistry_Host_Say; + class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -802,6 +806,8 @@ class IReGameHookchains { virtual IReGameHookRegistry_CBasePlayer_RemoveAllItems *CBasePlayer_RemoveAllItems() = 0; virtual IReGameHookRegistry_CBasePlayer_UpdateStatusBar *CBasePlayer_UpdateStatusBar() = 0; virtual IReGameHookRegistry_CBasePlayer_TakeDamageImpulse *CBasePlayer_TakeDamageImpulse() = 0; + + virtual IReGameHookRegistry_Host_Say *Host_Say() = 0; }; struct ReGameFuncs_t { diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index 7d03f922..228e2e7c 100644 --- a/reapi/src/hook_callback.cpp +++ b/reapi/src/hook_callback.cpp @@ -1786,6 +1786,16 @@ void CBasePlayer_TakeDamageImpulse(IReGameHook_CBasePlayer_TakeDamageImpulse *ch callVoidForward(RG_CBasePlayer_TakeDamageImpulse, original, indexOfEdict(pthis->pev), indexOfEdict(pAttacker->pev), flKnockbackForce, flVelModifier); } +void Host_Say(IReGameHook_Host_Say *chain, CBasePlayer *pPlayer, bool teamonly, const char *text, const char *pszFormat, const char *pszConsoleFormat, bool bSenderDead, const char *placeName, bool consoleUsed) +{ + auto original = [chain](int _pPlayer, bool _teamonly, const char *_text, const char *_pszFormat, const char *_pszConsoleFormat, bool _bSenderDead, const char *_placeName, bool _consoleUsed) + { + chain->callNext(getPrivate(_pPlayer), _teamonly, _text, _pszFormat, _pszConsoleFormat, _bSenderDead, _placeName, _consoleUsed); + }; + + callVoidForward(RG_Host_Say, original, indexOfEdict(pPlayer->pev), teamonly, text, pszFormat, pszConsoleFormat, bSenderDead, placeName, consoleUsed); +} + /* * VTC functions */ diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index 1065997a..61c4f252 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -576,6 +576,7 @@ void CBasePlayer_RemoveAllItems(IReGameHook_CBasePlayer_RemoveAllItems *chain, C void CSGameRules_SendDeathMessage(IReGameHook_CSGameRules_SendDeathMessage *chain, CBaseEntity *pKiller, CBasePlayer *pVictim, CBasePlayer *pAssister, entvars_t *pevInflictor, const char *killerWeaponName, int iDeathMessageFlags, int iRarityOfKill); void CBasePlayer_UpdateStatusBar(IReGameHook_CBasePlayer_UpdateStatusBar *chain, CBasePlayer *pthis); void CBasePlayer_TakeDamageImpulse(IReGameHook_CBasePlayer_TakeDamageImpulse *chain, CBasePlayer *pthis, CBasePlayer *pAttacker, float flKnockbackForce, float flVelModifier); +void Host_Say(IReGameHook_Host_Say *chain, CBasePlayer *pPlayer, bool teamonly, const char *text, const char *pszFormat, const char *pszConsoleFormat, bool bSenderDead, const char *placeName, bool consoleUsed); /* * VTC functions diff --git a/reapi/src/hook_list.cpp b/reapi/src/hook_list.cpp index cb8bd17e..1e06c9a0 100644 --- a/reapi/src/hook_list.cpp +++ b/reapi/src/hook_list.cpp @@ -145,6 +145,7 @@ hook_t hooklist_gamedll[] = { DLL(AddMultiDamage), DLL(ApplyMultiDamage), DLL(BuyItem), + DLL(Host_Say), }; hook_t hooklist_animating[] = { diff --git a/reapi/src/hook_list.h b/reapi/src/hook_list.h index 1cdb7bb4..7bb2fe31 100644 --- a/reapi/src/hook_list.h +++ b/reapi/src/hook_list.h @@ -161,6 +161,7 @@ enum GamedllFunc RG_AddMultiDamage, RG_ApplyMultiDamage, RG_BuyItem, + RG_Host_Say, // [...] };