From 8e7ba2e55d3970fe97da00fc0f6d0e4962552700 Mon Sep 17 00:00:00 2001 From: dystopm Date: Sun, 26 Nov 2023 02:23:08 -0300 Subject: [PATCH] Fix GiveC4 hook callback return type --- .../extra/amxmodx/scripting/include/reapi_gamedll_const.inc | 1 + reapi/src/hook_callback.cpp | 6 +++--- reapi/src/hook_callback.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc index 9749df4e..bebcc3d1 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -1165,6 +1165,7 @@ enum GamedllFunc_CSGameRules /* * Description: - + * Return type: CBasePlayer * (Entity index of player) * Params: () */ RG_CSGameRules_GiveC4, diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index 918c0550..5962a26b 100644 --- a/reapi/src/hook_callback.cpp +++ b/reapi/src/hook_callback.cpp @@ -972,14 +972,14 @@ void CSGameRules_RemoveGuns(IReGameHook_CSGameRules_RemoveGuns *chain) callVoidForward(RG_CSGameRules_RemoveGuns, original); } -void CSGameRules_GiveC4(IReGameHook_CSGameRules_GiveC4 *chain) +CBasePlayer *CSGameRules_GiveC4(IReGameHook_CSGameRules_GiveC4 *chain) { auto original = [chain]() { - chain->callNext(); + return indexOfPDataAmx(chain->callNext()); }; - callVoidForward(RG_CSGameRules_GiveC4, original); + return getPrivate(callForward(RG_CSGameRules_GiveC4, original)); } void CSGameRules_ChangeLevel(IReGameHook_CSGameRules_ChangeLevel *chain) diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index 089299d6..af39e6ad 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -476,7 +476,7 @@ void CSGameRules_CleanUpMap(IReGameHook_CSGameRules_CleanUpMap *chain); void CSGameRules_RestartRound(IReGameHook_CSGameRules_RestartRound *chain); void CSGameRules_CheckWinConditions(IReGameHook_CSGameRules_CheckWinConditions *chain); void CSGameRules_RemoveGuns(IReGameHook_CSGameRules_RemoveGuns *chain); -void CSGameRules_GiveC4(IReGameHook_CSGameRules_GiveC4 *chain); +CBasePlayer *CSGameRules_GiveC4(IReGameHook_CSGameRules_GiveC4 *chain); void CSGameRules_ChangeLevel(IReGameHook_CSGameRules_ChangeLevel *chain); void CSGameRules_GoToIntermission(IReGameHook_CSGameRules_GoToIntermission *chain); void CSGameRules_BalanceTeams(IReGameHook_CSGameRules_BalanceTeams *chain);