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

[BUG] [ script:qb-inventory] QBCore:HasItem is deprecated, please use QBCore.Functions.HasItem, it can be used on both server- and client-side and uses the same arguments. #835

Closed
KingyFrags opened this issue Sep 9, 2022 · 16 comments
Labels
bug Something isn't working

Comments

@KingyFrags
Copy link

Summary

When i use other items from other scripts they dont remove from the inventory, never had this problem till i updated core and inventory.

Reproduction

i updated the core and inventory
https://gyazo.com/53b658290137b491fbf3e300d061808a

Expected behavior

item should remove

Actual behavior

items dont remove

Additional context

i cant seem to see any fixes that explain it.
https://gyazo.com/53b658290137b491fbf3e300d061808a
i just get this message and people in my city are starting to abuse it and i dont want to keep removing scripts that i payed for.

Last Updated

today

Custom Resources

no

Resource Rename

qb-inventory

@KingyFrags KingyFrags added the bug Something isn't working label Sep 9, 2022
@JericoFX
Copy link
Contributor

JericoFX commented Sep 9, 2022

if you are using a custom inventory you need to tell the developer of that resource to update it, or if is open source you can just mimic the qb-inventory's functions

@KingyFrags
Copy link
Author

im using the qb-inventory

@xavlios
Copy link

xavlios commented Sep 11, 2022

I am also using qb-inventory and qb-core from this repo and aI am see the error aswell

@klose2410
Copy link

me 2

@xavlios
Copy link

xavlios commented Sep 12, 2022

I have found out why on my end i am seeing this. For those that are seeing this it does not deal with qb-core or qb-inventory. You have a script calling old methods that are in qb-core (QBCore:Server:UseItem, QBCore:Server:RemoveItem, and QBCore:Server:AddItem) the other scripts need to be updated to use the new way to use, remove and add items

@klose2410
Copy link

I have found out why on my end i am seeing this. For those that are seeing this it does not deal with qb-core or qb-inventory. You have a script calling old methods that are in qb-core (QBCore:Server:UseItem, QBCore:Server:RemoveItem, and QBCore:Server:AddItem) the other scripts need to be updated to use the new way to use, remove and add items

nice find but what do we done and legacyfuel it has QBcore:Server:Additem?:D

@KingyFrags
Copy link
Author

i know how to do it now.

@OnlyCure
Copy link

Update us on this when you can @KingyFrags please? Launched a server on the new core before noticing this issue I guess and attempting to fix now, this thread might be a lifesaver.

@KingyFrags
Copy link
Author

--server side code

RegisterNetEvent('FileNameHere:server:TriggerNameHere', function() ---eg,('qb-hunting:server:removeBait', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Player then return end
Player.Functions.RemoveItem('ItemNameHere', 1) ---eg, Player.Functions.RemoveItem('hunting_bait', 1)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["ItemNameHere"], "remove") ---eg, TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["hunting_bait"], "remove")
end)

--client side trigger
--find the trigger that may say "removeitem" and replace that line with the line below (edit to meet your own)

TriggerServerEvent('FileNameHere:server:TriggerNameHere') ---eg, TriggerServerEvent('qb-hunting:server:removeBait')

@KingyFrags
Copy link
Author

if you still need help dm me on discord Kingy#7870

@KingyFrags
Copy link
Author

https://www.youtube.com/watch?v=n5iDVt5nZMU&ab_channel=KingyFrags

@ezyhabz
Copy link

ezyhabz commented Oct 18, 2022

you're a savor thanks mate!

@KingyFrags
Copy link
Author

KingyFrags commented Dec 20, 2022 via email

@Soldierofthelam
Copy link

Thnx for the clear up and fast response,
I'll look into it, I think this script I'm using is gonna need a complete rewrite anyways the Author hasn't updated it in over a year. only issue I'm running into is people pumping out scripts for Qbcore and they get abandoned

@SwagDaddyBrad
Copy link

@KingyFrags Hope your pillow is cold on both sides my friend. Thank you for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants