Skip to content

Main-Scripts/main-inventory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Main Inventory

A custom inventory system for ESX Legacy with a modern UI similar to ox_inventory, featuring ox_lib integration for notifications and progress bars.

Features

  • ✨ Modern, responsive UI with drag & drop support
  • 🎯 Weight-based inventory system
  • πŸ”₯ Hotbar system (5 slots)
  • πŸ“¦ Item stacking and splitting
  • πŸŽ’ Context menu for quick actions
  • πŸ’Ό Vehicle trunk and glovebox support
  • πŸͺ Shop system with multiple locations
  • πŸ”§ Crafting system with workbenches
  • πŸ‘₯ Give items to nearby players
  • 🌍 Drop system with ground objects
  • πŸ”” ox_lib notifications
  • ⏳ ox_lib progress bars with animations
  • πŸ” Item search functionality
  • πŸ’Ž Item rarity system
  • πŸ“Š Real-time weight display
  • πŸ“‹ Organized item, shop, and crafting definitions

Dependencies

Installation

  1. Download and extract the main-inventory folder to your resources directory
  2. Ensure all dependencies are installed and started
  3. Add ensure main-inventory to your server.cfg
  4. Add your item images to html/items/ folder (PNG format, named after item name)
  5. Restart your server

Configuration

All configurations are now organized in separate files:

config.lua

  • Maximum inventory weight and slots
  • Hotbar settings
  • Drop lifetime and distance
  • Vehicle inventory sizes
  • Progress bar timings
  • Animations

shared/items.lua

  • Item definitions with metadata
  • Item weights, stackability, and descriptions
  • Item usage animations and effects
  • Illegal and rare item classifications

shared/shops.lua

  • Shop locations and items
  • Shop blip configurations
  • Job-restricted shops (police, ambulance, mechanic)
  • Item prices per shop
  • License requirements

shared/crafting.lua

  • Crafting recipes and requirements
  • Crafting bench locations
  • Job-restricted recipes
  • Material requirements
  • Crafting times

Usage

Opening Inventory

  • Default key: F2 (configurable in config.lua)
  • Command: /openInventory

Hotbar

  • Use items in hotbar slots with keys 1-5
  • Drag items from inventory to hotbar slots

Context Menu

  • Right-click on items to:
    • Use item
    • Give to nearby player
    • Drop item
    • Split stack

Commands

  • /openInventory - Open player inventory
  • /openstorage - Open storage (when near configured storage)
  • /craft - Open crafting menu (when near crafting bench)
  • /shoptest - Open 24/7 shop (testing command)

Exports

Client Exports

-- Open player inventory
exports['main-inventory']:OpenInventory()

-- Close inventory
exports['main-inventory']:CloseInventory()

-- Open target player inventory (for police search, etc.)
exports['main-inventory']:OpenTargetInventory(targetServerId)

-- Open shop
exports['main-inventory']:OpenShop(shopName)

-- Open vehicle inventory
exports['main-inventory']:OpenVehicleInventory(vehicle, 'trunk') -- or 'glovebox'

Server Events

-- Add item to player
TriggerEvent('main-inventory:addItem', source, itemName, count)

-- Remove item from player
TriggerEvent('main-inventory:removeItem', source, itemName, count)

-- Give item to another player
TriggerEvent('main-inventory:giveItem', source, targetId, itemName, count)

Item Images

Place your item images in html/items/ with the following format:

  • Filename: itemname.png (must match the item name in ESX)
  • Format: PNG with transparent background
  • Recommended size: 256x256 pixels
  • A default.png image will be used if item image is not found

Screenshots

[Add your screenshots here]

Customization

Adding New Items

Edit shared/items.lua:

['your_item'] = {
    label = 'Your Item Name',
    weight = 500, -- in grams
    stack = true, -- stackable?
    close = true, -- close inventory on use?
    description = 'Item description',
    rare = false, -- rare item?
    illegal = false, -- illegal item?
    client = {
        status = {hunger = 200000}, -- optional status effects
        anim = {dict = 'anim_dict', clip = 'anim_clip'}, -- usage animation
        usetime = 2500, -- time to use in ms
    }
}

Adding Custom Shops

Edit shared/shops.lua:

['your_shop'] = {
    name = 'Your Shop Name',
    blip = {
        sprite = 52,
        color = 2,
        scale = 0.8,
        display = 4,
    },
    items = {
        {name = 'bread', price = 5},
        {name = 'water', price = 3},
    },
    locations = {
        vector3(x, y, z),
    },
    jobs = {}, -- Optional: {'police', 'ambulance'}
    license = 'weapon', -- Optional: required license
}

Adding Crafting Recipes

Edit shared/crafting.lua:

-- Add recipe
['your_item'] = {
    label = 'Your Item',
    items = {
        {name = 'material1', amount = 2},
        {name = 'material2', amount = 1},
    },
    time = 5000, -- craft time in ms
    amount = 1, -- items crafted
    jobs = {}, -- Optional: job restrictions
    illegal = false, -- illegal recipe?
}

-- Add crafting bench
['your_bench'] = {
    label = 'Your Bench',
    recipes = {
        'your_item',
        'another_item',
    },
    locations = {
        vector3(x, y, z),
    },
    jobs = {}, -- Optional: job restrictions
}

Adding Storage/Stash

Edit config.lua:

Config.Stashes['storage_name'] = {
    label = 'Storage Label',
    slots = 50,
    weight = 100000,
    jobs = {'police'} -- Optional: restrict to specific jobs
}

Support

For issues, suggestions, or support:

License

This project is licensed under the MIT License.

Credits

  • Developed by Main-Scripts
  • Inspired by ox_inventory
  • Uses ox_lib for UI components
  • Built for ESX Legacy

Version History

1.0.0

  • Initial release
  • Basic inventory system
  • Hotbar implementation
  • Drop system
  • Vehicle inventory
  • Shop system with multiple locations
  • Crafting system with workbenches
  • Organized item/shop/crafting definitions
  • ox_lib integration
  • 50+ predefined items
  • Multiple shop types (24/7, liquor, hardware, weapons, job-specific)
  • Crafting benches (workbench, weapon bench, mechanic, kitchen, drug lab)

About

Inventory for ESX

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published