Installation
Installation of mInventory Remake Resource
Last updated
Installation of mInventory Remake Resource
Last updated
Drag and drop the " codem-inventory " folder to your resources folder.
Insert the " insert-me " sql file to your database.
Start the script in server.cfg
Start order must be like this in the image.
On the ESX Side this resource onyl supports New ESX 1.2 and further versions.
If you are using qb-core 1.2.6 you don't need to do any of this steps. Just download this qb-core version and use it.
You need progress bar script to work this resource.
You can download the supported progressbar from here.
In order to use the inventory's built in market system you need to delete the " qb-market " resource from your server.
Go to " client/functions.lua ". Find the following codes and replace them with the new ones.
Old One ⬇️
function QBCore.Functions.HasItem(items, amount)
return exports['qb-inventory']:HasItem(items, amount)
end
New One ⬇️ ( You need to replace it with this one below. )
function QBCore.Functions.HasItem(items, amount)
return exports['codem-inventory']:HasItem(items, amount)
end
Go to " server/functions.lua ". Find the following codes and replace them with the new ones.
Old One ⬇️
function QBCore.Functions.UseItem(source, item)
if GetResourceState('qb-inventory') == 'missing' then return end
exports['qb-inventory']:UseItem(source, item)
end
New One ⬇️ ( You need to replace it with this one below. )
function QBCore.Functions.UseItem(source, item)
if GetResourceState('codem-inventory') == 'missing' then return end
exports['codem-inventory']:UseItem(source, item)
end
Go to " server/functions.lua ". Find the following codes and replace them with the new ones.
Old One ⬇️
function QBCore.Functions.HasItem(source, items, amount)
if GetResourceState('qb-inventory') == 'missing' then return end
return exports['qb-inventory']:HasItem(source, items, amount)
end
New One ⬇️ ( You need to replace it with this one below. )
function QBCore.Functions.HasItem(source, items, amount)
if GetResourceState('codem-inventory') == 'missing' then return end
return exports['codem-inventory']:HasItem(source, items, amount)
end
Go to " server/player.lua ". ( Check Data Function ) Find the following codes and replace them with the new ones.
Old One ⬇️
PlayerData.items = GetResourceState('qb-inventory') ~= 'missing' and exports['qb-inventory']:LoadInventory(PlayerData.source, PlayerData.citizenid) or {}
New One ⬇️ ( You need to replace it with this one below. )
PlayerData.items = GetResourceState('codem-inventory') ~= 'missing' and
exports['codem-inventory']:LoadInventory(PlayerData.source, PlayerData.citizenid) or {}
Go to " server/player.lua ". ( Get Card Slot Function ) Find the following codes and replace them with the new ones.
Old One ⬇️
function self.Functions.GetCardSlot(cardNumber, cardType)
local item = tostring(cardType):lower()
local slots = exports['qb-inventory']:GetSlotsByItem(self.PlayerData.items, item)
for _, slot in pairs(slots) do
if slot then
if self.PlayerData.items[slot].info.cardNumber == cardNumber then
return slot
end
end
end
return nil
end
New One ⬇️ ( You need to replace it with this one below. )
function self.Functions.GetCardSlot(cardNumber, cardType)
local item = tostring(cardType):lower()
local slots = exports['codem-inventory']:GetSlotsByItem(self.PlayerData.items, item)
for _, slot in pairs(slots) do
if slot then
if self.PlayerData.items[slot].info.cardNumber == cardNumber then
return slot
end
end
end
return nil
end
Go to " server/player.lua ". ( SaveFunction ) Find the following codes and replace them with the new ones.
Old One ⬇️
function QBCore.Player.Save(source)
local ped = GetPlayerPed(source)
local pcoords = GetEntityCoords(ped)
local PlayerData = QBCore.Players[source].PlayerData
if PlayerData then
MySQL.insert(
'INSERT INTO players (citizenid, cid, license, name, money, charinfo, job, gang, position, metadata) VALUES (:citizenid, :cid, :license, :name, :money, :charinfo, :job, :gang, :position, :metadata) ON DUPLICATE KEY UPDATE cid = :cid, name = :name, money = :money, charinfo = :charinfo, job = :job, gang = :gang, position = :position, metadata = :metadata',
{
citizenid = PlayerData.citizenid,
cid = tonumber(PlayerData.cid),
license = PlayerData.license,
name = PlayerData.name,
money = json.encode(PlayerData.money),
charinfo = json.encode(PlayerData.charinfo),
job = json.encode(PlayerData.job),
gang = json.encode(PlayerData.gang),
position = json.encode(pcoords),
metadata = json.encode(PlayerData.metadata)
})
if GetResourceState('qb-inventory') ~= 'missing' then exports['qb-inventory']:SaveInventory(source) end
QBCore.ShowSuccess(resourceName, PlayerData.name .. ' PLAYER SAVED!')
else
QBCore.ShowError(resourceName, 'ERROR QBCORE.PLAYER.SAVE - PLAYERDATA IS EMPTY!')
end
end
New One ⬇️ ( You need to replace it with this one below. )
function QBCore.Player.Save(source)
local ped = GetPlayerPed(source)
local pcoords = GetEntityCoords(ped)
local PlayerData = QBCore.Players[source].PlayerData
if PlayerData then
MySQL.insert(
'INSERT INTO players (citizenid, cid, license, name, money, charinfo, job, gang, position, metadata) VALUES (:citizenid, :cid, :license, :name, :money, :charinfo, :job, :gang, :position, :metadata) ON DUPLICATE KEY UPDATE cid = :cid, name = :name, money = :money, charinfo = :charinfo, job = :job, gang = :gang, position = :position, metadata = :metadata',
{
citizenid = PlayerData.citizenid,
cid = tonumber(PlayerData.cid),
license = PlayerData.license,
name = PlayerData.name,
money = json.encode(PlayerData.money),
charinfo = json.encode(PlayerData.charinfo),
job = json.encode(PlayerData.job),
gang = json.encode(PlayerData.gang),
position = json.encode(pcoords),
metadata = json.encode(PlayerData.metadata)
})
if GetResourceState('codem-inventory') ~= 'missing' then exports['codem-inventory']:SaveInventory(source) end
QBCore.ShowSuccess(resourceName, PlayerData.name .. ' PLAYER SAVED!')
else
QBCore.ShowError(resourceName, 'ERROR QBCORE.PLAYER.SAVE - PLAYERDATA IS EMPTY!')
end
end
Go to " server/player.lua ". ( Save Offline Function ) Find the following codes and replace them with the new ones.
Old One ⬇️
function QBCore.Player.SaveOffline(PlayerData)
if PlayerData then
MySQL.Async.insert(
'INSERT INTO players (citizenid, cid, license, name, money, charinfo, job, gang, position, metadata) VALUES (:citizenid, :cid, :license, :name, :money, :charinfo, :job, :gang, :position, :metadata) ON DUPLICATE KEY UPDATE cid = :cid, name = :name, money = :money, charinfo = :charinfo, job = :job, gang = :gang, position = :position, metadata = :metadata',
{
citizenid = PlayerData.citizenid,
cid = tonumber(PlayerData.cid),
license = PlayerData.license,
name = PlayerData.name,
money = json.encode(PlayerData.money),
charinfo = json.encode(PlayerData.charinfo),
job = json.encode(PlayerData.job),
gang = json.encode(PlayerData.gang),
position = json.encode(PlayerData.position),
metadata = json.encode(PlayerData.metadata)
})
if GetResourceState('qb-inventory') ~= 'missing' then exports['qb-inventory']:SaveInventory(PlayerData, true) end
QBCore.ShowSuccess(resourceName, PlayerData.name .. ' OFFLINE PLAYER SAVED!')
else
QBCore.ShowError(resourceName, 'ERROR QBCORE.PLAYER.SAVEOFFLINE - PLAYERDATA IS EMPTY!')
end
end
New One ⬇️ ( You need to replace it with this one below. )
function QBCore.Player.SaveOffline(PlayerData)
if PlayerData then
MySQL.Async.insert(
'INSERT INTO players (citizenid, cid, license, name, money, charinfo, job, gang, position, metadata) VALUES (:citizenid, :cid, :license, :name, :money, :charinfo, :job, :gang, :position, :metadata) ON DUPLICATE KEY UPDATE cid = :cid, name = :name, money = :money, charinfo = :charinfo, job = :job, gang = :gang, position = :position, metadata = :metadata',
{
citizenid = PlayerData.citizenid,
cid = tonumber(PlayerData.cid),
license = PlayerData.license,
name = PlayerData.name,
money = json.encode(PlayerData.money),
charinfo = json.encode(PlayerData.charinfo),
job = json.encode(PlayerData.job),
gang = json.encode(PlayerData.gang),
position = json.encode(PlayerData.position),
metadata = json.encode(PlayerData.metadata)
})
if GetResourceState('codem-inventory') ~= 'missing' then exports['codem-inventory']:SaveInventory(PlayerData, true) end
QBCore.ShowSuccess(resourceName, PlayerData.name .. ' OFFLINE PLAYER SAVED!')
else
QBCore.ShowError(resourceName, 'ERROR QBCORE.PLAYER.SAVEOFFLINE - PLAYERDATA IS EMPTY!')
end
end
Go to " server/player.lua ". Find the following codes and replace them with the new ones.
Old One ⬇️
function QBCore.Player.SaveInventory(source)
if GetResourceState('qb-inventory') == 'missing' then return end
exports['qb-inventory']:SaveInventory(source, false)
end
function QBCore.Player.SaveOfflineInventory(PlayerData)
if GetResourceState('qb-inventory') == 'missing' then return end
exports['qb-inventory']:SaveInventory(PlayerData, true)
end
function QBCore.Player.GetTotalWeight(items)
if GetResourceState('qb-inventory') == 'missing' then return end
return exports['qb-inventory']:GetTotalWeight(items)
end
function QBCore.Player.GetSlotsByItem(items, itemName)
if GetResourceState('qb-inventory') == 'missing' then return end
return exports['qb-inventory']:GetSlotsByItem(items, itemName)
end
function QBCore.Player.GetFirstSlotByItem(items, itemName)
if GetResourceState('qb-inventory') == 'missing' then return end
return exports['qb-inventory']:GetFirstSlotByItem(items, itemName)
end
New One ⬇️ ( You need to replace it with this one below. )
function QBCore.Player.SaveInventory(source)
if GetResourceState('codem-inventory') == 'missing' then return end
exports['codem-inventory']:SaveInventory(source, false)
end
function QBCore.Player.SaveOfflineInventory(PlayerData)
if GetResourceState('codem-inventory') == 'missing' then return end
exports['codem-inventory']:SaveInventory(PlayerData, true)
end
function QBCore.Player.GetTotalWeight(items)
if GetResourceState('codem-inventory') == 'missing' then return end
return exports['codem-inventory']:GetTotalWeight(items)
end
function QBCore.Player.GetSlotsByItem(items, itemName)
if GetResourceState('codem-inventory') == 'missing' then return end
return exports['codem-inventory']:GetSlotsByItem(items, itemName)
end
function QBCore.Player.GetFirstSlotByItem(items, itemName)
if GetResourceState('codem-inventory') == 'missing' then return end
return exports['codem-inventory']:GetFirstSlotByItem(items, itemName)
end
Delete " qb-weapons " folder from your server
Delete also " weapdraw.lua " file from " qb-smallresources " folder.
You need progress bar script to work this resource.
You can download the supported progressbar from here.
If you don't want to deal all this steps you can download this core to work mInventory Remake on your ESX Server. Core Version : 1.10.4
Search the old code down below and replace it with the new one.
Old One ⬇️
MySQL.ready(function()
Core.DatabaseConnected = true
if not Config.OxInventory 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
else
TriggerEvent("__cfx_export_ox_inventory_Items", function(ref)
if ref then
ESX.Items = ref()
end
end)
AddEventHandler("ox_inventory:itemList", function(items)
ESX.Items = items
end)
while not next(ESX.Items) do
Wait(0)
end
end
ESX.RefreshJobs()
print(("[^2INFO^7] ESX ^5Legacy %s^0 initialized!"):format(GetResourceMetadata(GetCurrentResourceName(), "version", 0)))
StartDBSync()
if Config.EnablePaycheck then
StartPayCheck()
end
end)
New One ⬇️( You need to replace it with this one below. )
MySQL.ready(function()
Core.DatabaseConnected = true
if not Config.OxInventory then
ESX.Items = exports["codem-inventory"]:GetItemList()
while not next(ESX.Items) do
ESX.Items = exports["codem-inventory"]:GetItemList()
Wait(0)
end
else
TriggerEvent("__cfx_export_ox_inventory_Items", function(ref)
if ref then
ESX.Items = ref()
end
end)
AddEventHandler("ox_inventory:itemList", function(items)
ESX.Items = items
end)
while not next(ESX.Items) do
Wait(0)
end
end
ESX.RefreshJobs()
print(("[^2INFO^7] ESX ^5Legacy %s^0 initialized!"):format(GetResourceMetadata(GetCurrentResourceName(), "version", 0)))
StartDBSync()
if Config.EnablePaycheck then
StartPayCheck()
end
end)
Search the old code down below and replace it with the new one.
Old One ⬇️
function Core.SavePlayer(xPlayer, cb)
if not xPlayer.spawned then
return cb and cb()
end
updateHealthAndArmorInMetadata(xPlayer)
local parameters <const> = {
json.encode(xPlayer.getAccounts(true)),
xPlayer.job.name,
xPlayer.job.grade,
xPlayer.group,
json.encode(xPlayer.getCoords()),
json.encode(xPlayer.getInventory(true)),
json.encode(xPlayer.getLoadout(true)),
json.encode(xPlayer.getMeta()),
xPlayer.identifier,
}
MySQL.prepare(
"UPDATE `users` SET `accounts` = ?, `job` = ?, `job_grade` = ?, `group` = ?, `position` = ?, `inventory` = ?, `loadout` = ?, `metadata` = ? WHERE `identifier` = ?",
parameters,
function(affectedRows)
if affectedRows == 1 then
print(('[^2INFO^7] Saved player ^5"%s^7"'):format(xPlayer.name))
TriggerEvent("esx:playerSaved", xPlayer.playerId, xPlayer)
end
if cb then
cb()
end
end
)
end
New One ⬇️( You need to replace it with this one below. )
function Core.SavePlayer(xPlayer, cb)
if not xPlayer.spawned then
return cb and cb()
end
updateHealthAndArmorInMetadata(xPlayer)
local parameters <const> = {
json.encode(xPlayer.getAccounts(true)),
xPlayer.job.name,
xPlayer.job.grade,
xPlayer.group,
json.encode(xPlayer.getCoords()),
json.encode(xPlayer.getInventory(true)),
json.encode(xPlayer.getLoadout(true)),
json.encode(xPlayer.getMeta()),
xPlayer.identifier,
}
exports['codem-inventory']:SaveInventory(xPlayer.source)
MySQL.prepare(
"UPDATE `users` SET `accounts` = ?, `job` = ?, `job_grade` = ?, `group` = ?, `position` = ?, `inventory` = ?, `loadout` = ?, `metadata` = ? WHERE `identifier` = ?",
parameters,
function(affectedRows)
if affectedRows == 1 then
print(('[^2INFO^7] Saved player ^5"%s^7"'):format(xPlayer.name))
TriggerEvent("esx:playerSaved", xPlayer.playerId, xPlayer)
end
if cb then
cb()
end
end
)
end
Search the old code down below and replace it with the new one.
Old One ⬇️
function loadESXPlayer(identifier, playerId, isNew)
local userData = {
accounts = {},
inventory = {},
loadout = {},
weight = 0,
identifier = identifier,
firstName = "John",
lastName = "Doe",
dateofbirth = "01/01/2000",
height = 120,
dead = false,
}
local result = MySQL.prepare.await(loadPlayer, { identifier })
-- Accounts
local accounts = result.accounts
accounts = (accounts and accounts ~= "") and json.decode(accounts) or {}
for account, data in pairs(Config.Accounts) do
data.round = data.round or data.round == nil
local index = #userData.accounts + 1
userData.accounts[index] = {
name = account,
money = accounts[account] or Config.StartingAccountMoney[account] or 0,
label = data.label,
round = data.round,
index = index,
}
end
-- Job
local job, grade = result.job, tostring(result.job_grade)
if not ESX.DoesJobExist(job, grade) then
print(("[^3WARNING^7] Ignoring invalid job for ^5%s^7 [job: ^5%s^7, grade: ^5%s^7]"):format(identifier, job, grade))
job, grade = "unemployed", "0"
end
jobObject, gradeObject = ESX.Jobs[job], ESX.Jobs[job].grades[grade]
userData.job = {
id = jobObject.id,
name = jobObject.name,
label = jobObject.label,
grade = tonumber(grade),
grade_name = gradeObject.name,
grade_label = gradeObject.label,
grade_salary = gradeObject.salary,
skin_male = gradeObject.skin_male and json.decode(gradeObject.skin_male) or {},
skin_female = gradeObject.skin_female and json.decode(gradeObject.skin_female) or {},
}
-- Inventory
if not Config.OxInventory then
local inventory = (result.inventory and result.inventory ~= "") and json.decode(result.inventory) or {}
for name, item in pairs(ESX.Items) do
local count = inventory[name] or 0
userData.weight += (count * item.weight)
userData.inventory[#userData.inventory + 1] = {
name = name,
count = count,
label = item.label,
weight = item.weight,
usable = Core.UsableItemsCallbacks[name] ~= nil,
rare = item.rare,
canRemove = item.canRemove,
}
end
table.sort(userData.inventory, function(a, b)
return a.label < b.label
end)
elseif result.inventory and result.inventory ~= "" then
userData.inventory = json.decode(result.inventory)
end
-- Group
if result.group then
if result.group == "superadmin" then
userData.group = "admin"
print("[^3WARNING^7] ^5Superadmin^7 detected, setting group to ^5admin^7")
else
userData.group = result.group
end
else
userData.group = "user"
end
-- Loadout
if not Config.OxInventory then
if result.loadout and result.loadout ~= "" then
local loadout = json.decode(result.loadout)
for name, weapon in pairs(loadout) do
local label = ESX.GetWeaponLabel(name)
if label then
userData.loadout[#userData.loadout + 1] = {
name = name,
ammo = weapon.ammo,
label = label,
components = weapon.components or {},
tintIndex = weapon.tintIndex or 0,
}
end
end
end
end
-- Position
userData.coords = json.decode(result.position) or Config.DefaultSpawns[math.random(#Config.DefaultSpawns)]
-- Skin
userData.skin = (result.skin and result.skin ~= "") and json.decode(result.skin) or { sex = userData.sex == "f" and 1 or 0 }
-- Metadata
userData.metadata = (result.metadata and result.metadata ~= "") and json.decode(result.metadata) or {}
-- xPlayer Creation
local xPlayer = CreateExtendedPlayer(playerId, identifier, userData.group, userData.accounts, userData.inventory, userData.weight, userData.job, userData.loadout, GetPlayerName(playerId), userData.coords, userData.metadata)
ESX.Players[playerId] = xPlayer
Core.playersByIdentifier[identifier] = xPlayer
-- Identity
if result.firstname and result.firstname ~= "" then
userData.firstName = result.firstname
userData.lastName = result.lastname
xPlayer.set("firstName", result.firstname)
xPlayer.set("lastName", result.lastname)
xPlayer.setName(("%s %s"):format(result.firstname, result.lastname))
if result.dateofbirth then
userData.dateofbirth = result.dateofbirth
xPlayer.set("dateofbirth", result.dateofbirth)
end
if result.sex then
userData.sex = result.sex
xPlayer.set("sex", result.sex)
end
if result.height then
userData.height = result.height
xPlayer.set("height", result.height)
end
end
TriggerEvent("esx:playerLoaded", playerId, xPlayer, isNew)
userData.money = xPlayer.getMoney()
userData.maxWeight = xPlayer.getMaxWeight()
xPlayer.triggerEvent("esx:playerLoaded", userData, isNew, userData.skin)
if not Config.OxInventory then
xPlayer.triggerEvent("esx:createMissingPickups", Core.Pickups)
else
exports.ox_inventory:setPlayerInventory(xPlayer, userData.inventory)
if isNew then
local shared = json.decode(GetConvar("inventory:accounts", '["money"]'))
for i = 1, #shared do
local name = shared[i]
local account = Config.StartingAccountMoney[name]
if account then
exports.ox_inventory:AddItem(playerId, name, account)
end
end
end
end
xPlayer.triggerEvent("esx:registerSuggestions", Core.RegisteredCommands)
print(('[^2INFO^0] Player ^5"%s"^0 has connected to the server. ID: ^5%s^7'):format(xPlayer.getName(), playerId))
end
New One ⬇️( You need to replace it with this one below. )
function loadESXPlayer(identifier, playerId, isNew)
local userData = {
accounts = {},
inventory = {},
loadout = {},
weight = 0,
identifier = identifier,
firstName = "John",
lastName = "Doe",
dateofbirth = "01/01/2000",
height = 120,
dead = false,
}
local result = MySQL.prepare.await(loadPlayer, { identifier })
-- Accounts
local accounts = result.accounts
accounts = (accounts and accounts ~= "") and json.decode(accounts) or {}
for account, data in pairs(Config.Accounts) do
data.round = data.round or data.round == nil
local index = #userData.accounts + 1
userData.accounts[index] = {
name = account,
money = accounts[account] or Config.StartingAccountMoney[account] or 0,
label = data.label,
round = data.round,
index = index,
}
end
-- Job
local job, grade = result.job, tostring(result.job_grade)
if not ESX.DoesJobExist(job, grade) then
print(("[^3WARNING^7] Ignoring invalid job for ^5%s^7 [job: ^5%s^7, grade: ^5%s^7]"):format(identifier, job,
grade))
job, grade = "unemployed", "0"
end
jobObject, gradeObject = ESX.Jobs[job], ESX.Jobs[job].grades[grade]
userData.job = {
id = jobObject.id,
name = jobObject.name,
label = jobObject.label,
grade = tonumber(grade),
grade_name = gradeObject.name,
grade_label = gradeObject.label,
grade_salary = gradeObject.salary,
skin_male = gradeObject.skin_male and json.decode(gradeObject.skin_male) or {},
skin_female = gradeObject.skin_female and json.decode(gradeObject.skin_female) or {},
}
userData.inventory = {}
-- Group
if result.group then
if result.group == "superadmin" then
userData.group = "admin"
print("[^3WARNING^7] ^5Superadmin^7 detected, setting group to ^5admin^7")
else
userData.group = result.group
end
else
userData.group = "user"
end
-- Loadout
if not Config.OxInventory then
if result.loadout and result.loadout ~= "" then
local loadout = json.decode(result.loadout)
for name, weapon in pairs(loadout) do
local label = ESX.GetWeaponLabel(name)
if label then
userData.loadout[#userData.loadout + 1] = {
name = name,
ammo = weapon.ammo,
label = label,
components = weapon.components or {},
tintIndex = weapon.tintIndex or 0,
}
end
end
end
end
-- Position
userData.coords = json.decode(result.position) or Config.DefaultSpawns[math.random(#Config.DefaultSpawns)]
-- Skin
userData.skin = (result.skin and result.skin ~= "") and json.decode(result.skin) or
{ sex = userData.sex == "f" and 1 or 0 }
-- Metadata
userData.metadata = (result.metadata and result.metadata ~= "") and json.decode(result.metadata) or {}
-- xPlayer Creation
local xPlayer = CreateExtendedPlayer(playerId, identifier, userData.group, userData.accounts, userData.inventory,
userData.weight, userData.job, userData.loadout, GetPlayerName(playerId), userData.coords, userData.metadata)
ESX.Players[playerId] = xPlayer
Core.playersByIdentifier[identifier] = xPlayer
-- Identity
if result.firstname and result.firstname ~= "" then
userData.firstName = result.firstname
userData.lastName = result.lastname
xPlayer.set("firstName", result.firstname)
xPlayer.set("lastName", result.lastname)
xPlayer.setName(("%s %s"):format(result.firstname, result.lastname))
if result.dateofbirth then
userData.dateofbirth = result.dateofbirth
xPlayer.set("dateofbirth", result.dateofbirth)
end
if result.sex then
userData.sex = result.sex
xPlayer.set("sex", result.sex)
end
if result.height then
userData.height = result.height
xPlayer.set("height", result.height)
end
end
TriggerEvent("esx:playerLoaded", playerId, xPlayer, isNew)
local inventory = exports['codem-inventory']:LoadInventory(playerId)
xPlayer.set('inv', inventory)
userData.money = xPlayer.getMoney()
userData.maxWeight = xPlayer.getMaxWeight()
xPlayer.triggerEvent("esx:playerLoaded", userData, isNew, userData.skin)
if not Config.OxInventory then
xPlayer.triggerEvent("esx:createMissingPickups", Core.Pickups)
else
exports.ox_inventory:setPlayerInventory(xPlayer, userData.inventory)
if isNew then
local shared = json.decode(GetConvar("inventory:accounts", '["money"]'))
for i = 1, #shared do
local name = shared[i]
local account = Config.StartingAccountMoney[name]
if account then
exports.ox_inventory:AddItem(playerId, name, account)
end
end
end
end
xPlayer.triggerEvent("esx:registerSuggestions", Core.RegisteredCommands)
print(('[^2INFO^0] Player ^5"%s"^0 has connected to the server. ID: ^5%s^7'):format(xPlayer.getName(), playerId))
end
Search the old code down below and replace it with the new one.
Old One ⬇️
function self.getInventory(minimal)
if minimal then
local minimalInventory = {}
for _, v in ipairs(self.inventory) do
if v.count > 0 then
minimalInventory[v.name] = v.count
end
end
return minimalInventory
end
return self.inventory
end
New One ⬇️( You need to replace it with this one below. )
function self.getInventory(minimal)
return exports["codem-inventory"]:GetInventory(self.identifier, self.source)
end
Search the old code down below and replace it with the new one.
Old One ⬇️
function self.getInventoryItem(itemName)
for _, v in ipairs(self.inventory) do
if v.name == itemName then
return v
end
end
return nil
end
New One ⬇️( You need to replace it with this one below. )
function self.getInventoryItem(itemName)
return exports["codem-inventory"]:GetItemByName(self.source, itemName)
end