diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc index 8bc5eff..bfee811 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -38,6 +38,7 @@ #define RG_CBasePlayerWeapon_DefaultReload RG_CBaseWeapon_DefReload #define RG_CBasePlayerWeapon_DefaultShotgunReload RG_CBaseWeapon_DefShotgunReload #define RG_CBasePlayer_Observer_SetMode RG_CBasePlayer_Observer_SetMod + #define RG_CBasePlayer_Observer_FindNextPlayer RG_CBasePlayer_Observer_FindNxt #endif /** @@ -791,7 +792,14 @@ enum GamedllFunc_CBasePlayer * Params: (const this, iMode) */ RG_CBasePlayer_Observer_SetMode, - + + /* + * Description: Called when a client attempt to find the next observer. + * Return type: void + * Params: (const this, bool bReverse, name[]) + */ + RG_CBasePlayer_Observer_FindNextPlayer, + /* * Description: Called when a client emits a "pain sound" after received damage. * Return type: void diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h index 7924fae..541b918 100644 --- a/reapi/include/cssdk/dlls/regamedll_api.h +++ b/reapi/include/cssdk/dlls/regamedll_api.h @@ -505,6 +505,10 @@ typedef IHookChainRegistryClass IReGameHook_CBasePlayer_Observer_SetMode; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Observer_SetMode; +// CBasePlayer::Observer_FindNextPlayer hook +typedef IHookChainClass IReGameHook_CBasePlayer_Observer_FindNextPlayer; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Observer_FindNextPlayer; + // CBasePlayer::Pain hook typedef IHookChainClass IReGameHook_CBasePlayer_Pain; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Pain; @@ -645,7 +649,8 @@ public: virtual IReGameHookRegistry_CBaseEntity_FireBullets3 *CBaseEntity_FireBullets3() = 0; virtual IReGameHookRegistry_CBasePlayer_Observer_SetMode *CBasePlayer_Observer_SetMode() = 0; - + virtual IReGameHookRegistry_CBasePlayer_Observer_FindNextPlayer *CBasePlayer_Observer_FindNextPlayer() = 0; + virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain() = 0; virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound() = 0; virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink() = 0; diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index 5a030b2..9941d50 100644 --- a/reapi/src/hook_callback.cpp +++ b/reapi/src/hook_callback.cpp @@ -298,6 +298,16 @@ CBasePlayer *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer return getPrivate(callForward(RG_CBasePlayer_Observer_IsValidTarget, original, indexOfEdict(pthis->pev), iPlayerIndex, bSameTeam)); } +void CBasePlayer_Observer_FindNextPlayer(IReGameHook_CBasePlayer_Observer_FindNextPlayer *chain, CBasePlayer *pthis, bool bReverse, const char *name) +{ + auto original = [chain](int _pthis, bool _bReverse, const char *_name) + { + chain->callNext(getPrivate(_pthis), _bReverse, _name); + }; + + callVoidForward(RG_CBasePlayer_Observer_FindNextPlayer, original, indexOfEdict(pthis->pev), bReverse, name); +} + void CBasePlayer_SetAnimation(IReGameHook_CBasePlayer_SetAnimation *chain, CBasePlayer *pthis, PLAYER_ANIM playerAnim) { auto original = [chain](int _pthis, PLAYER_ANIM _playerAnim) diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index 4069b52..3dc3f6e 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -402,6 +402,7 @@ void CBasePlayer_RoundRespawn(IReGameHook_CBasePlayer_RoundRespawn *chain, CBase void CBasePlayer_Blind(IReGameHook_CBasePlayer_Blind *chain, CBasePlayer *pthis, float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha); CBasePlayer *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer_IsValidTarget *chain, CBasePlayer *pthis, int iPlayerIndex, bool bSameTeam); +void CBasePlayer_Observer_FindNextPlayer(IReGameHook_CBasePlayer_Observer_FindNextPlayer *chain, CBasePlayer *pthis, bool bReverse, const char *name); void CBasePlayer_SetAnimation(IReGameHook_CBasePlayer_SetAnimation *chain, CBasePlayer *pthis, PLAYER_ANIM playerAnim); void CBasePlayer_GiveDefaultItems(IReGameHook_CBasePlayer_GiveDefaultItems *chain, CBasePlayer *pthis); CBaseEntity *CBasePlayer_GiveNamedItem(IReGameHook_CBasePlayer_GiveNamedItem *chain, CBasePlayer *pthis, const char *pszName); diff --git a/reapi/src/hook_list.cpp b/reapi/src/hook_list.cpp index 25b83c3..bf52208 100644 --- a/reapi/src/hook_list.cpp +++ b/reapi/src/hook_list.cpp @@ -169,6 +169,7 @@ hook_t hooklist_player[] = { DLL(CBasePlayer_DropIdlePlayer), DLL(CBasePlayer_Observer_SetMode), + DLL(CBasePlayer_Observer_FindNextPlayer), DLL(CBasePlayer_Pain), DLL(CBasePlayer_DeathSound), diff --git a/reapi/src/hook_list.h b/reapi/src/hook_list.h index 496a230..c95cd47 100644 --- a/reapi/src/hook_list.h +++ b/reapi/src/hook_list.h @@ -194,6 +194,7 @@ enum GamedllFunc_CBasePlayer RG_CBasePlayer_DropIdlePlayer, RG_CBasePlayer_Observer_SetMode, + RG_CBasePlayer_Observer_FindNextPlayer, RG_CBasePlayer_Pain, RG_CBasePlayer_DeathSound,