From 2e25c3ef98757b75bce7044e86389603742f37ce Mon Sep 17 00:00:00 2001 From: not-log Date: Fri, 4 Jun 2021 17:59:23 +0300 Subject: [PATCH] update HookSendSound --- scripting/SoundManager.sp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripting/SoundManager.sp b/scripting/SoundManager.sp index 4df232c..21e5fb4 100644 --- a/scripting/SoundManager.sp +++ b/scripting/SoundManager.sp @@ -274,20 +274,21 @@ void HookSendSound() DHookAddParam(hFunction, HookParamType_ObjectPtr); DHookAddParam(hFunction, HookParamType_Bool); - StartPrepSDKCall(SDKCall_Raw); - PrepSDKCall_SetFromConf(hGameData, SDKConf_Virtual, "CBaseClient::GetPlayerSlot"); - PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain); - - if (!(gH_GetPlayerSlot = EndPrepSDKCall())) - { - SetFailState("Could not initialize call to CBaseClient::GetPlayerSlot."); - } - if(!DHookEnableDetour(hFunction, false, DHook_SendSound)) { SetFailState("Couldn't enable CGameClient::SendSound detour."); } + StartPrepSDKCall(SDKCall_Raw); + PrepSDKCall_SetFromConf(hGameData, SDKConf_Virtual, "CBaseClient::GetPlayerSlot"); + PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain); + gH_GetPlayerSlot = EndPrepSDKCall(); + + if(gH_GetPlayerSlot == null) + { + SetFailState("Could not initialize call to CBaseClient::GetPlayerSlot."); + } + delete hGameData; }