Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

/**
Expand Down
6 changes: 6 additions & 0 deletions reapi/include/cssdk/dlls/regamedll_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,10 @@ typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBa
typedef IHookChainClass<void, class CBasePlayer, class CBasePlayer *, float, float> IReGameHook_CBasePlayer_TakeDamageImpulse;
typedef IHookChainRegistryClass<void, class CBasePlayer, class CBasePlayer *, float, float> IReGameHookRegistry_CBasePlayer_TakeDamageImpulse;

// Host_Say hook
typedef IHookChain<void, CBasePlayer *, bool, const char *, const char *, const char *, bool, const char *, bool> IReGameHook_Host_Say;
typedef IHookChainRegistry<void, CBasePlayer *, bool, const char *, const char *, const char *, bool, const char *, bool> IReGameHookRegistry_Host_Say;

class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions reapi/src/hook_callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CBasePlayer>(_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
*/
Expand Down
1 change: 1 addition & 0 deletions reapi/src/hook_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions reapi/src/hook_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ hook_t hooklist_gamedll[] = {
DLL(AddMultiDamage),
DLL(ApplyMultiDamage),
DLL(BuyItem),
DLL(Host_Say),
};

hook_t hooklist_animating[] = {
Expand Down
1 change: 1 addition & 0 deletions reapi/src/hook_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ enum GamedllFunc
RG_AddMultiDamage,
RG_ApplyMultiDamage,
RG_BuyItem,
RG_Host_Say,

// [...]
};
Expand Down