qb-core
qb-core copied to clipboard
[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.
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
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
im using the qb-inventory
I am also using qb-inventory and qb-core from this repo and aI am see the error aswell
me 2
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
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
i know how to do it now.
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.
--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')
if you still need help dm me on discord Kingy#7870
https://www.youtube.com/watch?v=n5iDVt5nZMU&ab_channel=KingyFrags
you're a savor thanks mate!
I say in the video "this is for outdated scripts, find the script where the item dosent get removed from the inventory and follow the steps" for example I'm the video I was fixing my qb- jewellry script so I was changing the cl main and server main inside qb jewellery.
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Soldierofthelam @.> Sent: Tuesday, December 20, 2022 3:15:36 AM To: qbcore-framework/qb-core @.> Cc: KingyFrags @.>; Mention @.> Subject: Re: [qbcore-framework/qb-core] [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. (Issue #835)
https://www.youtube.com/watch?v=n5iDVt5nZMU&ab_channel=KingyFrags
This video didn't help at all, Never specifies exactly where to go into what files fix, you just state go into server files, ok... which server files , core files? inventory? files? When going into the inventory files there is no "remove.items" in the CL Main file.
the only "bug-QBCore:HasItem" is only one script that I added it for drugs
— Reply to this email directly, view it on GitHubhttps://github.com/qbcore-framework/qb-core/issues/835#issuecomment-1358784023, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZHCEXQHW2O7XVKAEK7TCSTWOEQFRANCNFSM6AAAAAAQIT27GE. You are receiving this because you were mentioned.Message ID: @.***>
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
@KingyFrags Hope your pillow is cold on both sides my friend. Thank you for the help.