Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make easy crafting hook for ox inventory #1869

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

nurrifqialhusaini
Copy link
Contributor

I've been using this method for a very long time, it's time for me to share hehe
This will make you not have to worry if you create a new crafting in writing random inline code.
In the doc, we need benchId and/or benchIndex for specific bench what we want.
But we will make it easier and safer when making a hook by just giving it its name

This add new parameter for documentation in crafting hooks

benchName : string (optional)

For usage, just like this

local hooks = exports.ox_inventory:registerHook('craftItem', function(payload)
    if payload.benchName == 'debug_crafting' then
        -- add your code for the hooks, maybe logs ?
    end
    return true
end)

Conclusion: This method only helps make it easier for you to create a hook using a pre-set name without having to look at or calculate the benchId that has been created in crafting.lua. Sorry for my bad english, hope it helps

Discord Forum Post : Overextended Discord

@thelindat thelindat merged commit 1f0e10a into overextended:main Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants