qbcore-framework / qb-core

FiveM RP Framework Core :muscle:
GNU General Public License v3.0
590 stars 960 forks source link

[BUG] QBCore.Functions.AddItem(itemName, info) has never worked as intended #961

Closed jimathy closed 1 year ago

jimathy commented 1 year ago

Summary

QBCore.Functions.AddItem(itemName, info) has never worked as intended

Reproduction

I've been trying to make a resource for a few days now and debugging the shared exports/functions to add AddItems to the shared

From what I can tell is, it only shares to players/other scripts if that script client side of the script is started when the items are added.

I managed to get it working fine (with insane lag per item) if I was connected to the server at the time. The second I tried to make it load at server launch then make use of the items after connecting, they are nil

Anyone connecting after the items are added seems to not get the updated list, just the default shared list.

Expected behavior

Shared item list is supposed to be shared to everyone when UpdateObject is used.

Actual behavior

Clients connecting AFTER the shared is updated don't seem to get the new shared tables.

Additional context

This is me after a day of debugging my script for issues: Don't advertise this AddItem feature as working if it doesn't work.

This seems to have been the case since it was added last year.

Last Updated

This month

Custom Resources

My own testing script

Resource Rename

N/A

Xerrass commented 1 year ago

can Confirm! NEther the export nor the function work as intendet

zjdaniels1985 commented 1 year ago

Function doesn't work still.

GhzGarage commented 1 year ago

Thanks, I'll check this out

github-actions[bot] commented 1 year ago

This issue has had 60 days of inactivity & will close within 7 days

bandgeekndb commented 1 year ago

@GhzGarage has there been any progress on this?

Before this gets closed for inactivity, this is still a bug that needs addressing before we can call the AddItem/AddJob/etc. exports functional.

Looks like #988 has tackled this and it's the same solution I was thinking of PRing. One-time update when players connect of all the QBCore.Shared tables from the server where they are fully up-to-date. Any reason we can't merge this in?

GhzGarage commented 1 year ago

Was waiting on a few changes but it's free to try out now before i merge! https://github.com/qbcore-framework/qb-core/pull/988