# Guide

## LVS Inventory Guide

### Table of Contents

1. Introduction
2. Configuration Files
3. Enhanced ox\_inventory Features
4. Custom Data Files
5. Setup Instructions
6. Troubleshooting

***

### Introduction

LVS Inventory is an enhanced version of ox\_inventory that adds additional features and customization options for your FiveM server. This guide will help you understand and configure the various aspects of the system.

#### Key Features

* Enhanced backpack system with configurable sizes and restrictions
* Special item slots (tool, armor, backpack, identification, phone, tablet, key, wallet)
* Prop holding system with 3D item visualization
* Vehicle inventory improvements
* Persistent item placement
* Body damage integration

***

### Configuration Files

#### Main Configuration (`config/config.lua`)

This is the primary configuration file that controls core inventory behavior.

```lua
Config = Config or {}

-- Interaction settings for placed items
Config.Interaction = {
   type = 'interact', -- ['draw3DText', 'interact', 'target'] - interaction system type
   distance = 1.0, -- Interaction distance
   view = 2.5 -- Interaction display distance
}

-- Persistent items configuration
Config.Persistent = {
    enabled = true,
    maxPlacedForPlayer = 5 -- Max placed items per player
}

-- Body damage integration
Config.bodyDamageEnabled = true

-- Slot plugins toggles
Config.BackpackEnabled = true -- Enable backpack logic
Config.CheckForNestedBackpacks = true -- Prevent backpack nesting
Config.ToolEnabled = true -- Enable tool slot logic
Config.ArmourEnabled = true -- Enable armor slot logic

-- Language settings
Config.Lang = {
    input = {
        header = 'Backpack Tag',
        tag_label = 'Backpack tag',
        tag_desc = 'Enter a new tag for the backpack',
        submit_btn = 'Save',
        updated = 'Backpack updated'
    },
    notify = {
        inventory_title = 'Inventory',
        cant_carry = 'Can\'t carry too many things',
        max_placed_items = 'Maximum number of items placed reached',
    },
    text3d = {
        pickup_label = '~h~{ITEM_LABEL}~h~',
        pickup_count = 'x{ITEM_COUNT}',
    },
    target = {
        pickup = 'Pickup',
        icon  = 'fas fa-box'
    }
}

Config.Debug = true -- Enable debug mode
```

#### Holding System Configuration (`config/holding.lua`)

Configures the prop holding system that displays items as 3D objects when held.

```lua
Config = Config or {}

-- Keybinds for item interactions
Config.keybinds = {
    cancel = { label = 'Cancel', key = 'Backspace', keyIndex = 177 },
    rotateL = { label = 'Left', key = 'Scroll Down', keyIndex = 96 },
    rotateR = { label = 'Right', key = 'Scroll UP', keyIndex = 97 },
    drop = { label = 'Drop', key = 'G', keyIndex = 58 },
    throw = { label = 'Throw', key = 'Q', keyIndex = 52 },
    place = { label = 'Place', key = 'E', keyIndex = 38 },
    pickup = { label = '~g~[E]~s~ to pickup', keyIndex = 38 }
}

-- Fallback settings for items without specific configurations
Config.fallback = {
    model = 'prop_paper_bag_small',
    hold = {
        bone = 28422, -- Right hand bone
        offset = vector3(0.15, 0.0, 0.0),
        rotation = vector3(0.0, 270.0, 0.0),
    }
}

-- Preview settings for placement
Config.preview = {
    alpha = 140, -- Opacity (0-255)
    errorColor = {255, 0, 0}, -- Red for invalid placement
    successColor = {0, 255, 0}, -- Green for valid placement
    persistentColor = {255, 255, 0} -- Yellow for persistent placement
}

-- Visual settings
Config.textFont = 4
Config.textScale = 1.0
Config.outline = {
    enabled = true,
    color = { r = 126, g = 207, b = 147, a = 144 }
}
```

#### Vehicle Configuration (`config/vehicle.lua`)

Manages vehicle-specific inventory features.

```lua
Config = Config or {}

-- Pickup trucks with truck beds for item placement
Config.pickupTrucks = {
    'bison', 'bison2', 'bison3', 'bobcatxl', 'bodhi2', 'boor',
    'guardian', 'l35', 'rebel', 'rebel2', 'sadler', 'sadler2',
    'sandking', 'sandking2', 'contender', 'dloader', 'scrap',
    'slamvan', 'slamvan3', 'tiptruck', 'vetir', 'mesa3',
    'warrener2', 'wastelander', 'driftyosemite', 'yosemite',
    'yosemite2', 'yosemite3', 'insurgent', 'insurgent3', 'mule',
    'mule2', 'mule3', 'mule4', 'mule5', 'benson'
}

-- Enable item dropping when vehicle is flipped
Config.FlippedEnabled = true

-- Vehicles whose props shouldn't be released when flipped
Config.enclosedVehicles = {
    'mule', 'mule2', 'mule3', 'mule4', 'mule5', 'pounder',
    'pounder2', 'stockade', 'benson', 'benson2'
}
```

***

### Enhanced ox\_inventory Features

#### Backpack System

The backpack system allows players to carry additional inventory slots through wearable backpacks.

**Configuration Structure**

Backpacks are configured in `ox_inventory/data/backpacks.lua`:

```lua
return {
    lvs_backpack_1 = {
        slots = 5,
        maxWeight = 3000,
        -- Optional restriction system
        blacklist = { 'WEAPON_PUMPSHOTGUN' }, -- Items not allowed
        -- OR
        -- whitelist = { 'testburger' }, -- Only items allowed
        
        -- Visual appearance
        prop = {
            model = 'sf_prop_sf_backpack_01a',
            boneIndex = 24818, -- Back bone
            position = {
                x = -0.15, y = -0.15, z = -0.05,
                rot_x = -5.0, rot_y = 90.0, rot_z = 0.0
            }
        }
    },
    
    lvs_backpack_2 = {
        slots = 15,
        maxWeight = 20000,
        prop = {
            model = 'vw_prop_vw_backpack_01a',
            boneIndex = 24818,
            position = { x = -0.17, y = -0.06, z = 0.0, rot_x = 0.0, rot_y = 90.0, rot_z = 180.0 }
        }
    }
}
```

**Specialized Backpacks**

The system also includes specialized backpacks like medical bags:

```lua
lvs_paramedic_bag = {
    slots = 20,
    maxWeight = 50000,
    whitelist = { 'bandage', 'water' }, -- Only medical items
    prop = {
        model = 'xm_prop_smug_crate_s_medical',
        boneIndex = 57005, -- Right hand
        position = { x = 0.29, y = -0.05, z = 0.0, rot_x = -25.0, rot_y = 280.0, rot_z = 75.0 },
        animation = {
            dict = 'missheistdocksprep1hold_cellphone',
            anim = 'static'
        },
        removeOnUseWeapon = true
    }
}
```

#### Special Slots System

The inventory supports special item types with dedicated UI icons:

**Configuration**

Server configuration defines available special slots:

```cfg
setr inventory:specialslots ["tool", "armour", "three", "four", "backpack", "identification", "phone", "tablet", "key", "wallet"]
setr inventory:specialslotsicons ["tool", "armour", "counter_3", "counter_4", "backpack", "id_card", "phone_iphone", "tablet", "key", "wallet"]
```

**Tool Slot**

Configured in `ox_inventory/data/tools.lua`:

```lua
return {
    lvs_wrench = {
        durability = 100, -- Tool durability
    },
    lvs_lug_wrench = {
        durability = 100,
    }
}
```

**Armor Slot**

Configured in `ox_inventory/data/vest.lua`:

```lua
return {
    lvs_light_vest = {
        durability = 60,
        cloth = {
            male = { vest = { item = 11, texture = 1 } },
            female = { vest = { item = 0, texture = 0 } }
        }
    },
    lvs_heavy_vest = {
        durability = 100,
        cloth = {
            male = { vest = { item = 15, texture = 2 } },
            female = { vest = { item = 0, texture = 0 } }
        }
    }
}
```

#### Prop Holding System

This system displays items as 3D objects when held by players.

**Enabling Item Holding**

To enable the prop holding system, ensure `inventory:heldall` is set to `true` in your server.cfg. This allows all items to be held, dropped, thrown, and placed.

**Individual Item Configuration**

Even with `inventory:heldall` disabled, you can control which specific items can be held by adding a `held = true` property to their configuration in `ox_inventory/data/items.lua`:

```lua
['money'] = {
    label = 'Money',
    held = true, -- This enables holding for this specific item
    client = {
        image = 'lvs_cash.png',
    }
},
```

**Item Props Configuration**

Item props are configured in `ox_inventory/data/props.lua`:

```lua
return {
    -- Basic item configuration
    burger = {
        model = 'ng_proc_food_bag02a',
        droppable = true,
        throwable = true,
        placeable = false,
        persistent = true
    },
    
    -- Items with hold positioning
    money = {
        model = 'prop_anim_cash_pile_01',
        hold = {
            bone = 28422,
            offset = vector3(0.08, 0.0, -0.02),
            rotation = vector3(20.0, 0.0, 0.0)
        }
    },
    
    -- Items with custom animations
    radio = {
        model = 'prop_cs_hand_radio',
        hold = {
            bone = 28422,
            offset = vector3(0.08, 0.05, 0.0),
            rotation = vector3(290.0, 0.0, 0.0)
        }
    }
}
```

**Common Bones**

* **28422** - SKEL\_R\_Finger02 (Right hand)
* **18905** - SKEL\_L\_Finger02 (Left hand)
* **64729** - SPINE1 (Spine)
* **31086** - HEAD (Head)
* **57005** - SKEL\_R\_Forearm (Right forearm)

#### Display Metadata System

Configured in `ox_inventory/data/display.lua`:

```lua
return {
    id_number = 'Number',
    id_firstname = 'Name',
    id_lastname = 'Surname',
    id_dob = 'Date of Birth',
    id_sex = 'Gender',
    id_nationality = 'Nationality',
    id_class = 'Class',
    id_grade = 'Grade',
    id_job = 'Job',
}
```

This system controls how item metadata is displayed to players in the UI.

{% hint style="info" %}
If you need any specific labels for metadata, you can define them here. This is loaded every time the script starts
{% endhint %}

***

### Setup Instructions

#### Basic Configuration

1. **Enable/Disable Features**
   * Toggle features in `config/config.lua` as needed
   * Set `Config.Debug = true` during setup, then `false` for production
2. **Server Configuration** Add these to your server.cfg:

   ```cfg
   setr inventory:framework "qbx"
   setr inventory:slots 25
   setr inventory:weight 30000
   setr inventory:dropslots 40
   setr inventory:dropweight 30000
   setr inventory:specialslots ["tool", "armour", "three", "four", "backpack", "identification", "phone", "tablet", "key", "wallet"]
   setr inventory:specialslotsicons ["tool", "armour", "counter_3", "counter_4", "backpack", "id_card", "phone_iphone", "tablet", "key", "wallet"]
   setr inventory:heldall true
   setr inventory:target true
   setr inventory:screenblur false
   setr inventory:keys ["F2", "K", "TAB"]
   setr inventory:giveplayerlist false
   setr inventory:weaponanims true
   setr inventory:itemnotify true
   setr inventory:weaponnotify true
   setr inventory:dropprops true
   setr inventory:dropmodel "prop_med_bag_01b"
   set inventory:versioncheck false
   set inventory:clearstashes "4 MONTH"
   set inventory:bulkstashsave 1
   set inventory:loglevel 0
   set inventory:randomloot false
   ```
3. **Customizing Backpacks**
   * Edit `ox_inventory/data/backpacks.lua`
   * Add new backpack entries with desired slots, weight, and restrictions
4. **Setting Up Item Props**
   * Configure 3D props in `ox_inventory/data/props.lua`
   * Define models, positioning, and animations for each item
5. **Special Items Configuration**
   * Configure tools in `data/tools.lua`
   * Configure armor in `data/vest.lua`
   * Customize display metadata in `data/display.lua`

#### Advanced Customization

**Creating Custom Backpacks**

1. Add a new entry to the backpacks table:

```lua
my_custom_backpack = {
    slots = 25,
    maxWeight = 50000,
    -- Optional: Restrict certain items
    blacklist = { 'WEAPON_', 'DRUG_' },
    -- Visual configuration
    prop = {
        model = 'my_custom_backpack_model',
        boneIndex = 24818,
        position = { x = -0.2, y = -0.1, z = -0.05 }
    }
}
```

**Custom Item Props**

1. Define a new prop configuration:

```lua
my_custom_item = {
    model = 'prop_custom_item',
    hold = {
        bone = 28422,
        offset = vector3(0.1, 0.0, -0.05),
        rotation = vector3(0.0, 0.0, 45.0),
        animation = {
            dict = 'anim@custom@carry',
            anim = 'idle'
        }
    }
}
```

### Troubleshooting

#### Common Issues

1. **Backpacks Not Working**
   * Ensure `Config.BackpackEnabled = true` in config.lua
   * Check that backpack entries are properly formatted
   * Verify lvs\_bridge is properly installed
2. **Props Not Showing**
   * Confirm `inventory:heldall` is set to `true` in server.cfg
   * Check that item models are valid and loaded
   * Ensure prop configurations are correctly formatted
3. **Special Slots Not Functioning**
   * Verify server configuration includes special slots
   * Check that items have the correct metadata types
   * Ensure ox\_lib is updated to the required version
4. **Performance Issues**
   * Reduce `Config.Debug` to `false` in production
   * Limit the number of persistent items with `Config.Persistent.maxPlacedForPlayer`
   * Consider reducing backpack slot counts if needed

#### Debug Mode

When enabled (`Config.Debug = true`), the system will provide additional information in the console to help identify issues. Use this during setup but disable it for production servers.

#### Getting Help

If you encounter issues not covered in this guide:

1. Check the console for error messages
2. Verify all configuration files are properly formatted
3. Ensure all required dependencies are installed and updated
4. Check the LVS documentation for additional resources

***

This guide should help you understand and configure the lvs\_inventory system effectively. For more detailed information about specific features, refer to the individual configuration files and test changes in a development environment before deploying to production.
