[SOLVED] Can't register a usable item (ExtendedMode)

I got two files on my server.

esx.lua (set to load first in the manifest)

ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

drugs.lua

ESX.RegisterUsableItem('crack', function(source)
    local player = ESX.GetPlayerFromId(source)
    player.removeInventoryItem('crack', 1)
end)
server_scripts {
    "server/esx.lua",
    "server/drugs.lua",
    -- other stuff removed
}

However, the callback is not being attached correctly. When I drag the crack item from my inventory hud to the use button, it shows as it can’t be used.

The item is registered correctly, and the ESX shared object works fine; it’s just the register part. Other resources work perfectly, just my resource doing this.

I’m using manifest version cerulean if it matters.

Ok the problem was solved by just changing the manifest version to adamant. I thought about that possible solution only while writing this thread, so I decided to try it.
I don’t understand why ESX would not register a callback sent from a cerulean resource, but at least now we know it, and I hope this thread will be useful to anyone having a similar issue.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.