ESX

1. Framework configuration:

A. es_extended version highter or equal too 1.11.0

in es_extended/shared/config/main.lua, replace

Config.CustomInventory = false

by

Config.CustomInventory = 'core_inventory'
Config.CoreInventory = Config.CustomInventory == 'core_inventory'

in es_extended/server/common.lua, arround line ( replace

if not Config.CustomInventory then
    local items = MySQL.query.await("SELECT * FROM items")
    for _, v in ipairs(items) do
        ESX.Items[v.name] = { label = v.label, weight = v.weight, rare = v.rare, canRemove = v.can_remove }
    end
end

by

if not Config.CustomInventory or Config.CustomInventory == 'core_inventory' then
    local items = MySQL.query.await("SELECT * FROM items")
    for _, v in ipairs(items) do
        ESX.Items[v.name] = { label = v.label, weight = v.weight, rare = v.rare, canRemove = v.can_remove }
    end
end

Now, in es_extended/server/classes/overrides add this file into the folder :

Now you can go to step2. Global configuration


B. es_extended from 1.7.5 to 1.10.X

in es_extended/config.lua, under

Config.OxInventory = GetResourceState("ox_inventory") ~= 'missing'

add :

Config.CoreInventory = GetResourceState("core_inventory") ~= 'missing'

in es_extended/server/common.lua , under

if Config.OxInventory then
    Config.PlayerFunctionOverride = "OxInventory"
    SetConvarReplicated("inventory:framework", "esx")
    SetConvarReplicated("inventory:weight", Config.MaxWeight * 1000)
end

add:

if Config.CoreInventory then
    Config.PlayerFunctionOverride = "CoreInventory"
    SetConvarReplicated("inventory:framework", "esx")
    SetConvarReplicated("inventory:weight", Config.MaxWeight * 1000)
end

Now, in es_extended/server/classes/overrides add this file into the folder :

Now you can go to step2. Global configuration


C. es_extended version lower than 1.7.5 (example: ESX 1.2)

Please set NewEsx = falsein your core inventory/config.lua

Replace existing functions by these functions in es_extended/server/classes/player.lua Note : All of these function should be placed inside the CreateExtendedPlayer function

function self.getInventory(minimal, inventory)
        inventory = inventory or 'content-' ..  self.identifier:gsub(":", "")
        return exports['core_inventory']:getInventory(inventory)
end
function self.getInventoryItem(name, inventory)
	inventory = inventory or 'content-' ..  self.identifier:gsub(":", "")
        return exports['core_inventory']:getItem(inventory, name)
end
function self.addInventoryItem(name, count, metadata, inventory)
        count = count or 1
        inventory = inventory or 'content-' ..  self.identifier:gsub(":", "")
        local result = exports['core_inventory']:addItem(inventory, name, tonumber(count), metadata)
        if result then
                TriggerClientEvent('core_inventory:client:notification', self.source, name, 'add',  tonumber(count))
        end
        return result
end
function self.removeInventoryItem(name, count, inventory)
         count = count or 1         
         inventory = inventory or 'content-' ..  self.identifier:gsub(":", "")
         local result = exports['core_inventory']:removeItem(inventory, name, tonumber(count))
         if result then
                TriggerClientEvent('core_inventory:client:notification', self.source, name, 'remove',  tonumber(count))
         end
         return result
end
function self.canCarryItem(name, count, inventory, metadata)
        count = count or 1
        inventory = inventory or 'content-' ..  self.identifier:gsub(":", "")
        return exports['core_inventory']:canCarry(inventory, name, count, metadata)
end

2. Global configuration

  • Add the image of your items in core_inventory/html/img folder.

  • All your images should have the same name as your items. For example, if you have an item called sandwich_bacon, the image name should be sandwich_bacon.png.

  • Only .png image are include in the FXManifest so be sure to use this extension for your images

  • if you don't have weapon as item, run the sql file called core_weapons.sql on your dataabse to add it.

  • If you already have it, pelase make sure to set the category as weapons for all the weapon item in your item database

  • if you don't have all the weapon component, run the sql file called core_weapon_component.sql on your database to add it.

  • for each item in your items database table, configure the category, if you don't set category, the default apply by the SQL file is misc

  • the stack property come from the category apply to the item. The default one apply is misc and the stack value is 2. If you want to increase / decrease this number, open core_inventory/config.lua and search for ItemCategories section. You can create a new category and then apply this category in your item database. To disable stack, don't set a property stack to the item category.

  • You can configure the x and y value for each item, x is the number column take by the item, y the number of row. The default value is 1x1

  • For backpack item, you need to set the backpackModel (list can be find here) and the backpackTexture (default is 0 for each backpack model)

  • To add image's item, just put the image file (with .png extension) in the core_inventory/html/img folder

3. Money as item

In core_inventory/config.lua make sure to enable the money as item option and set the right account name in the option, for example :

MoneyAsItem = true,
AccountMoneyAsItem = 'money',
ItemMoneyAsItem = 'money',

DirtyMoneyAsItem = true,
AccountDirtyMoneyAsItem = 'black_money',
ItemDirtyMoneyAsItem = 'markedbills',

Make sure to also have the item in your item database called money (with money category set on it ) and markedbills (with markedbill category set on it)

Last updated