ScriptsAboutBlogToolsKnowledge BaseReviewsFAQBasketDocsSupport
QBCoreserver

Player.Functions.AddItem

QBCore server documentation with a FiveM Lua example.

Summary

Adds an item to a player's inventory in QBCore's native inventory. (On ox_inventory servers, use the ox_inventory exports instead.)

Returns

boolean — whether it succeeded.

Parameters

itemstringThe item name (must exist in shared items).
amountnumberHow many to add.
slotnumberOptional slot.
infotableOptional metadata.

Example

local Player = QBCore.Functions.GetPlayer(src)
if Player.Functions.AddItem('water', 1) then
  TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['water'], 'add')
end

Common pitfalls

  • The item must be defined in QBCore shared items or it fails.
  • On servers using ox_inventory, use exports.ox_inventory:AddItem instead — mixing systems causes bugs.

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 →