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

feat: remove usable item fn after stopped resource #1109

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Z3rio
Copy link
Contributor

@Z3rio Z3rio commented May 25, 2024

Description

This PR aims to fix an error that can be recreated by trying to use an item after the resource which said item callback from is stopped.

Recreation:

  • Give yourself a radio
  • Stop qb-radio
  • Use the radio item

And you'll see the following error:

[      script:qb-core] SCRIPT ERROR: citizen:/scripting/lua/scheduler.lua:479: attempt to concatenate a nil value (local 'err')
[      script:qb-core] > UseItem (@qb-inventory/server/functions.lua:167)
[      script:qb-core] > handler (@qb-inventory/server/main.lua:177)
[ script:qb-inventory] SCRIPT ERROR: error object is not a string

The way it fixes the error is by saving which resource the "useable item callback" is created by.
And then listening for stopped resources and removing said "useable item callback" upon said resource being stopped.

Checklist

  • I have personally loaded this code into an updated qbcore project and checked all of its functionality.
  • My code fits the style guidelines.
  • My PR fits the contribution guidelines.

This needs to be merged alongside:
qbcore-framework/qb-inventory#519

Copy link

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

@github-actions github-actions bot added the Stale label Sep 24, 2024
@Z3rio
Copy link
Contributor Author

Z3rio commented Sep 24, 2024

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

no thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants