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

RegisterCraftingBench #1830

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

RegisterCraftingBench #1830

wants to merge 4 commits into from

Conversation

lokkafr
Copy link

@lokkafr lokkafr commented Nov 4, 2024

Created the RegisterCraftingBench export server-side so that developers can create benches dynamically in the same was as stashes. I didn't concern myself with security for the client event as the main scripts code handles distance checks and checking if a bench exists.

Created an export to remotely register new crafting benches (like possible with RegisterStash).
@lokkafr lokkafr marked this pull request as draft November 4, 2024 06:05
@lokkafr
Copy link
Author

lokkafr commented Nov 4, 2024

Through testing, I just found an error where, due to the await, the inventory does not ready in time on the client side. Simply corrected by changing the callback.

createCraftingBench(id, data)
end)

lib.callback('ox_inventory:getCraftingBenches', false, function(data) for id, data in pairs(data) do createCraftingBench(id, data) end end)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename the var data in the loop

Suggested change
lib.callback('ox_inventory:getCraftingBenches', false, function(data) for id, data in pairs(data) do createCraftingBench(id, data) end end)
lib.callback('ox_inventory:getCraftingBenches', false, function(data) for id, bench in pairs(data) do createCraftingBench(id, bench) end end)

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