NATIVE HOOK

HookNative

Registers a callback that runs before a native executes.

Syntax

ONYX.HookNative(nativeHash, hookFunction)

Parameters

  • nativeHash (integer) — Hash of the native function to hook.
  • hookFunction (function) — Callback that handles the interception.

Return(s)

None

Behavior

  • Your hook receives (script, arg1..argN, ret1..retN) like the native it wraps.
  • script = true runs the original native body; script = false blocks it and uses the values you return.
  • Return values are written into ret1..retN before the native returns.
  • Native argument modification is not supported yet; only boolean, number, string and table are supported as custom return values (Vector3 is not).

Example(s)

ONYX.HookNative(0x00A0EA33BCF5F4F7, function(script, playerId)
  return true
end)