diff --git a/extensions/sdkhooks/extension.cpp b/extensions/sdkhooks/extension.cpp index db089ac62..78d23965d 100644 --- a/extensions/sdkhooks/extension.cpp +++ b/extensions/sdkhooks/extension.cpp @@ -540,10 +540,11 @@ HookReturn SDKHooks::Hook(int entity, SDKHookType type, IPluginFunction *callbac return HookRet_BadEntForHookType; } + int bcompatRef = gamehelpers->EntityToBCompatRef(pEnt); bool bHooked = false; HOOKLOOP { - if (g_HookList[i].entity == entity && g_HookList[i].type == type) + if (g_HookList[i].entity == bcompatRef && g_HookList[i].type == type) { bHooked = true; break; @@ -677,7 +678,7 @@ HookReturn SDKHooks::Hook(int entity, SDKHookType type, IPluginFunction *callbac // Add hook to hook list HookList hook; - hook.entity = entity; + hook.entity = bcompatRef; hook.type = type; hook.callback = callback; g_HookList.AddToTail(hook); diff --git a/extensions/sdkhooks/natives.cpp b/extensions/sdkhooks/natives.cpp index ec9a7306b..5f433eb9f 100644 --- a/extensions/sdkhooks/natives.cpp +++ b/extensions/sdkhooks/natives.cpp @@ -90,7 +90,7 @@ cell_t Native_HookEx(IPluginContext *pContext, const cell_t *params) cell_t Native_Unhook(IPluginContext *pContext, const cell_t *params) { - int entity = (int)params[1]; + int entity = gamehelpers->ReferenceToBCompatRef(params[1]); SDKHookType type = (SDKHookType)params[2]; IPluginFunction *callback = pContext->GetFunctionById(params[3]);