> For the complete documentation index, see [llms.txt](https://refresh-cx.gitbook.io/refresh.cx-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://refresh-cx.gitbook.io/refresh.cx-docs/scripting/hook-native.md).

# Hook Native

Hooks a native. Pass a constant (string, number, boolean) to always override the return without calling the original, or a function for full control. The first function return is always `callOriginal`: true calls the original and ignores the rest, false skips it and applies the remaining returns. Returns true on success. Natives hooked by the cheat itself are refused.

## **Syntax**

```lua
refresh.Scripting.HookNative(hashOrName, valueOrFn) -> Boolean
```

## **Return**

{% hint style="success" %}
Boolean (success)
{% endhint %}

## Usage Example

```lua
refresh.Scripting.HookNative("GetPlayerName", "refresh.cx")

refresh.Scripting.HookNative("GetCurrentPedWeapon", function(ped, p2)
    if ped == PlayerPedId() then
        return false, true, 0xBFEFFF6D
    end
    return true
end)
```
