mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-08 19:08:35 +00:00
Fix hooking inconsistencies in SDKHooks when hooking by ent ref (bug 6069).
This commit is contained in:
parent
24c12197ee
commit
170a086b1e
@ -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);
|
||||
|
||||
@ -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]);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user