How to make esx_inventoryhud work with jsfour-licenseplate?

Hello,

I have installed jsfour-licenseplate and added the item into the shop and all, and it works fine, but when i press f2 (inventory) i cant drag it, i use esx_inventoryhud which uses drag and i have added license plate into the inventoryhud config but still i can get it to drag. Normally you drag f e bread or water into use and it works fine, but not with the license plate, someone please help!

From the top of my head, being able to use food is handled through basicneeds. What you can do is look through a mod that already has usable items (bandage? medkit? repair kit?) and use the code from there for your own purpose.

For example, here in extraitems you get extra items for your shop and some code that makes it usable. The client-side code determines what is actually done when used, and the server-side code removes the item from your inventory when used. Hopefully this is enough info to help you on your way. :slight_smile:

edit: Forgot the link. Here goes nothing.

i dont really know script

Good question, hope we can find the answer

I think you might have to add something like ESX:registerusableitem in the script.

It’'s pretty easy

Just fill item name with the name from the db, Then put the event or function in the trigger code area and boom.

ESX.RegisterUsableItem('itemName', function(playerId)

    local xPlayer = ESX.GetPlayerFromId(playerId)

    xPlayer.removeInventoryItem('itemName', 1)

    -- trigger the code you want here

end)
-- Usable license plate
ESX.RegisterUsableItem('licenseplate', function(source)
	TriggerClientEvent('jsfour-licenseplate', source)
end)

Thats the code from that script.

ok, can you type me the EXACT code for it and where i put it

i mean it should be in there if you download the script try reinstalling it?

i don’t get it :open_mouth:

1 Like

I think he’s saying to change
server.lua

ESX.RegisterUsableItem('licenseplate', function(source)
	TriggerClientEvent('jsfour-licenseplate', source)
end)

to

ESX.RegisterUsableItem('licenseplate', function(source)
	local xPlayer = ESX.GetPlayerFromId(playerId)
    xPlayer.removeInventoryItem('licenseplate', 1)
	TriggerClientEvent('jsfour-licenseplate', source)
end)

But i am not sure if thats what he’s saying