ox_inventory icon indicating copy to clipboard operation
ox_inventory copied to clipboard

Allow creating a workbench on a specific prop.

Open lush0n3 opened this issue 10 months ago • 5 comments

Is your feature request related to a problem? Please describe. It would be nice to be able to create crafting spots in a prop. For example, a cooking prop could have food recipes, where people can cook their food.

This works very well with servers that use furnished properties.

Describe the solution you'd like Ability to create crafting points on a specific model.

Describe alternatives you've considered N/A

Additional context N/A

lush0n3 avatar Mar 26 '24 11:03 lush0n3

It is already implemented if you use ox_target. Simply ox_target model, openinv__> crafting. ID is from top to bottom in the crafting.lua. So 1 first crafting table etc. . Crafting table must have no target or points, otherwise it will try to determine the distance. Done, you have a crafting on the prop (model).. Have fun.

morpheus1076 avatar Jul 20 '24 19:07 morpheus1076

@morpheus1076 It sounds easy but unfortunately the crafting system does not allow there to be no zones or points.

I tried several ways including the one you tell me and I was unsuccessful.

did you make it work? If so, can you guide me?

lush0n3 avatar Jul 20 '24 23:07 lush0n3

I have it ... so it do .. because it takes distance from player, when there ist no point or target.

ox_target::: exports.ox_target:addModel('h4_prop_h4_weed_dry_01a', {name = 'weedprop', label = 'Herstellen', onSelect = function() exports.ox_inventory:openInventory('crafting', {id = 1}) end, distance = 1.5})

ox_inventory: crafting.lua { --ID-TABLE: 1 Weed items = { { name = 'afghan', ingredients = { afghanzweig = 20 }, duration = 60000, count = 10, }, { name = 'afghan_joint', ingredients = { afghan = 20, eblaettchen = 20 }, duration = 60000, count = 10, }, } },

And work perfect ... so Yes its implemented. 👯

morpheus1076 avatar Jul 21 '24 06:07 morpheus1076

oh sorry i forgot, here the ox_inventory:: modules ::: crafting ::: server.lua ... where you see, that implemented::: ---falls back to player coords if zones and points are both nil ---@param source number ---@param bench table ---@param index number ---@return vector3 local function getCraftingCoords(source, bench, index) if not bench.zones and not bench.points then return GetEntityCoords(GetPlayerPed(source)) else return shared.target and bench.zones[index].coords or bench.points[index] end end

morpheus1076 avatar Jul 21 '24 06:07 morpheus1076

Now it works for me, I was leaving the point and zone tables empty, but I had to delete them completely, thank you very much for your help!

lush0n3 avatar Jul 22 '24 21:07 lush0n3