qb-core icon indicating copy to clipboard operation
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.

Open KingyFrags opened this issue 2 years ago • 11 comments

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 avatar Sep 09 '22 12:09 KingyFrags

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

JericoFX avatar Sep 09 '22 15:09 JericoFX

im using the qb-inventory

KingyFrags avatar Sep 09 '22 15:09 KingyFrags

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

xavlios avatar Sep 11 '22 01:09 xavlios

me 2

klose2410 avatar Sep 11 '22 21:09 klose2410

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

xavlios avatar Sep 12 '22 14:09 xavlios

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

klose2410 avatar Sep 12 '22 21:09 klose2410

i know how to do it now.

KingyFrags avatar Sep 13 '22 00:09 KingyFrags

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.

OnlyCure avatar Sep 13 '22 03:09 OnlyCure

--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 avatar Sep 13 '22 09:09 KingyFrags

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

KingyFrags avatar Sep 13 '22 09:09 KingyFrags

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

KingyFrags avatar Sep 14 '22 15:09 KingyFrags

you're a savor thanks mate!

ezyhabz avatar Oct 18 '22 13:10 ezyhabz

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: @.***>

KingyFrags avatar Dec 20 '22 08:12 KingyFrags

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

Soldierofthelam avatar Dec 20 '22 19:12 Soldierofthelam

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

SwagDaddyBrad avatar Dec 28 '22 01:12 SwagDaddyBrad