ScriptsAboutBlogToolsKnowledge BaseReviewsFAQBasketDocsSupport
QBCoreserver

QBCore.Functions.CreateUseableItem

QBCore server documentation with a FiveM Lua example.

Summary

Registers a callback that runs when a player uses a given item. The standard way to make items do something in QBCore.

Returns

void

Parameters

itemstringThe item name.
callbackfunctionfunction(source, item) that runs on use.

Example

QBCore.Functions.CreateUseableItem('bandage', function(source, item)
  local Player = QBCore.Functions.GetPlayer(source)
  if not Player then return end
  -- heal logic here
end)

Common pitfalls

  • The item must exist in your inventory's items list.
  • Always re-validate the player still has the item server-side before consuming it.

Related functions

Related guides

Managing jobs on your server?

Viper Multi-Job lets players hold several jobs and switch between them with grade, salary and duty handled — QBCore, QBox and ESX, validated server-side.

See Viper Multi-Job →