ScriptlerliveBaseEnglish
Inventory & Item Giving
Item definition vs inventory giving, AddItem flow, security rules, and new script template.
🌐 Türkçe · Envanter ve Item Verme
This section explains the difference between item definitions and giving items to players, plus all giving paths and security rules.
Two layers: definition vs inventory
| Layer | What it does | API | Data source |
|---|---|---|---|
| Item definition | Registers item metadata | liveBase.Functions.AddItem(name, item) | liveShared.Items |
| Give to inventory | Adds physical item to slots | exports['liveInventory']:AddItem(...) | PlayerData.items |
exports['liveBase']:AddItem('water', {...}) adds an item definition; it does not
give water to a player. Use the liveInventory API to give items.
Definitions: liveBase/data/items.lua · Starters: liveBase/shared/utils.lua → StarterItems
Central function: AddItem
File: liveInventory/server/functions.lua
AddItem(identifier, item, amount, slot, info, reason)
exports['liveInventory']:AddItem(source, 'water', 2, false, {}, 'myScript:reward')Player method injection
After login (liveBase:Server:PlayerLoaded):
Player.Functions.AddItem(item, amount, slot, info, reason)
Player.Functions.RemoveItem(item, amount, slot, reason)Giving paths
| Path | Description |
|---|---|
/giveitem [id] [item] [amount] | Admin — permission: admin.giveitem |
| Inventory UI GiveItem | Player to player (< 3m) |
GiveStarterItems | Character creation |
| Your script | Player.Functions.AddItem(...) (recommended) |
Recommended script usage
local Player = liveBase.Functions.GetPlayer(source)
if not Player then return end
local ok = Player.Functions.AddItem('water', 2, nil, {}, 'myJob:questReward')
if ok then
TriggerClientEvent('liveInventory:client:ItemBox', source, liveShared.Items['water'], 'add', 2)
endAdding item definitions
liveShared.Items['my_item'] = {
name = 'my_item',
label = 'My Item',
weight = 100,
type = 'item',
unique = false,
useable = true,
}Common mistakes
| Mistake | Fix |
|---|---|
Using liveBase:AddItem to give to player | Use liveInventory:AddItem or Player.Functions.AddItem |
| AddItem before login | Wait for PlayerLoaded |
| Uppercase item name | Use lowercase (water) |
Full inventory API → liveInventory