#cw-crafting not working for ox_inventory ammo

1 messages · Page 1 of 1 (latest)

hardy kraken
#

1. Include error logs. Both client and server side

Required resources: cw-crafting
ResourceCache::AddEntry: Saved cache:v1:053fe0f36fd60c1eac894023b0ac0f6111492eda to the index cache.
Creating script environments for cw-crafting
Error parsing script @cw-crafting/config.lua in resource cw-crafting: @cw-crafting/config.lua:505: malformed number near '9m'
Failed to load script config.lua.
Error parsing script @cw-crafting/config.lua in resource cw-crafting: @cw-crafting/config.lua:505: malformed number near '9m'
Failed to load script config.lua.
^1SCRIPT ERROR: @cw-crafting/bridge/client/qbox.lua:3: attempt to index a nil value (global 'Config')^7
^3> fn^7 (^5@cw-crafting/bridge/client/qbox.lua^7:3)
^1SCRIPT ERROR: @cw-crafting/client/client.lua:8: attempt to index a nil value (global 'Config')^7
^3> fn^7 (^5@cw-crafting/client/client.lua^7:8)
Uncaught (in promise) AxiosError: Request failed with status code 404 (@cw-crafting/html/dist/assets/index-e7dbe031.js:7)

2. When did the error occur?

Error occurred when attempting to add ammunition to a crafting table. It appears to be due to the formatting/naming of the item as ammo-9mm.

3. Did you change anything in the config?

Example of item that was added to the config below:

['ammo-9mm'] = {
category = "Ammunition", -- category
toItems = { -- table that includes the output and their amounts, this one will output 2 lockpicks
ammo-9mm = 20,
},
type = nil, -- type of recipe. This is used to display breakdown recipes correctly for example. Valid values: nil or 'breakdown'
materials = { -- table that includes the input and their material cost
ls_copper_ingot = 1,
ls_lead_ingot = 1,
},
label = '9×19mm Rounds', -- label that shows in crafting menu, will default to item in toItems (if 1) or the recipe name (in this case 'lockpick') otherwise (optional, higly suggested)
craftingSkill= 0, -- crafting skill required to craft this. Defaults to 0 if unset (optional)
craftingTime= 5000, -- crafting time (optional)
tables = {'ammo'}, -- specific tables this recipe can be made at
},

4. Did you double check your config file changes?

Yes, I made certain to confirm that there were no differences from the other items I had successfully added to crafting tables before

5. Did you change anything outside of the Config file? Did you try with a clean version?

I have not made any changes outside of the config file

6. Post your Debug Logs

Nothing is debugged as the script fails on start up

7. Do you have any other scripts that might have and impact on the issue?

N/A

8. If any items, did you add all the items?

N/A

9. Have you investigated the error location and confirmed that it's not due to your other scripts?

Yes, the error location is in the cw-crafting config file and is not caused by other scripts

10. Be specific: Exactly what did you do to cause the error.

Added item ammo-9mm to a crafting table I was making for ammunition. The error occurs due to naming/formatting of the item in the toItems option of the crafting item setup.

dusty crater
#

You can't define it like this

When naming properties you can only have "_" as a non letter/number.

Needs to be ['ammo-9mm']

hardy kraken
#

Right, I figured that out but then the items do not show up in the crafting table for me although the error does disappear

#

Could it be because the ammo is not in the items.lua but in the weapons.lua in ox_inventory?

dusty crater
#

maybe yeah

#

Try adding it as an item

hardy kraken
#

Sure thing. I'll try that now.

#

Yes, looks like it has to be in the items.lua to show up

hardy kraken
#

That also makes it impossible to reload a gun I have found out 😅

#

Any chance you can assist with implementing a solution that would allow the ammo to be craftable?

dusty crater
#

If you need it faster, feel free to dm me about a commission for prioritization.

dusty crater
#

Actually, I think it's just user error.
To create ammo for ox inv you need to set "ammo = true" in the metadata.
That's how we have it and it works fine.

hardy kraken
#

Interesting, was not aware of this possibility and didn't see anything about that in the readme but it does work to resolve the ammo not appearing in the crafting bench. Does something similar need to be done for weapons then too or is it only necessary for ammo?

dusty crater
#

Yeah it's not realy a cw-crafting specific thing. It's a ox specific thing. Same with how ox does weapons.

#

I think there's a an example for weapons?

hardy kraken
#

Thanks, I'll have a look through the ox docs again and check that out. I appreciate your help.