diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc index 82749cb4..a20fc927 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -39,6 +39,7 @@ #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 + #define RG_CSGameRules_PlayerRelationship RG_CSGameRules_PlayerRelation #endif /** @@ -1272,6 +1273,13 @@ enum GamedllFunc_CSGameRules * Params: (const pKiller, const pVictim, const pAssister, const pevInflictor, const killerWeaponName[], const DeathMessageFlags:iDeathMessageFlags, const KillRarity:iRarityOfKill) */ RG_CSGameRules_SendDeathMessage, + + /* + * Description: What is the player's relationship with this entity? + * Return type: int + * Params: (const pPlayer, const pEntity) + */ + RG_CSGameRules_PlayerRelationship, }; /** diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h index 62273fe6..449957ad 100644 --- a/reapi/include/cssdk/dlls/regamedll_api.h +++ b/reapi/include/cssdk/dlls/regamedll_api.h @@ -40,7 +40,7 @@ #include #define REGAMEDLL_API_VERSION_MAJOR 5 -#define REGAMEDLL_API_VERSION_MINOR 30 +#define REGAMEDLL_API_VERSION_MINOR 31 // CBasePlayer::Spawn hook typedef IHookChainClass IReGameHook_CBasePlayer_Spawn; @@ -638,6 +638,10 @@ typedef IHookChainRegistryClass IReGameHookRegistry_CBa typedef IHookChainClass IReGameHook_CBasePlayer_TakeDamageImpulse; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_TakeDamageImpulse; +// CHalfLifeMultiplay::PlayerRelationship hook +typedef IHookChain IReGameHook_CSGameRules_PlayerRelationship; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_PlayerRelationship; + class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -802,6 +806,7 @@ 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_CSGameRules_PlayerRelationship *CSGameRules_PlayerRelationship() = 0; }; struct ReGameFuncs_t { diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index fdb723e4..457069d2 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); } +int CSGameRules_PlayerRelationship(IReGameHook_CSGameRules_PlayerRelationship *chain, CBasePlayer *pPlayer, CBaseEntity *pEntity) +{ + auto original = [chain](int _pPlayer, int _pEntity) + { + return chain->callNext(getPrivate(_pPlayer), getPrivate(_pEntity)); + }; + + return callForward(RG_CSGameRules_PlayerRelationship, original, indexOfEdict(pPlayer->pev), indexOfEdict(pEntity->pev)); +} + /* * VTC functions */ diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index 1065997a..1d7e7a4c 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); +int CSGameRules_PlayerRelationship(IReGameHook_CSGameRules_PlayerRelationship *chain, CBasePlayer *pPlayer, CBaseEntity *pEntity); /* * VTC functions diff --git a/reapi/src/hook_list.cpp b/reapi/src/hook_list.cpp index cb8bd17e..64f4b11d 100644 --- a/reapi/src/hook_list.cpp +++ b/reapi/src/hook_list.cpp @@ -250,6 +250,7 @@ hook_t hooklist_gamerules[] = { DLL(CSGameRules_TeamStacked), DLL(CSGameRules_PlayerGotWeapon), DLL(CSGameRules_SendDeathMessage), + DLL(CSGameRules_PlayerRelationship), }; hook_t hooklist_grenade[] = { diff --git a/reapi/src/hook_list.h b/reapi/src/hook_list.h index 1cdb7bb4..5ea51001 100644 --- a/reapi/src/hook_list.h +++ b/reapi/src/hook_list.h @@ -310,6 +310,7 @@ enum GamedllFunc_CSGameRules RG_CSGameRules_TeamStacked, RG_CSGameRules_PlayerGotWeapon, RG_CSGameRules_SendDeathMessage, + RG_CSGameRules_PlayerRelationship, // [...] }; diff --git a/reapi/version/version.h b/reapi/version/version.h index d3e8b9db..3838a2f8 100644 --- a/reapi/version/version.h +++ b/reapi/version/version.h @@ -6,5 +6,5 @@ #pragma once #define VERSION_MAJOR 5 -#define VERSION_MINOR 29 +#define VERSION_MINOR 30 #define VERSION_MAINTENANCE 0