Inventory
If you have an inventory that is not marked in Config.Inventory = '', you can add your inventory in a fully customized way, by default we have configured the esx, qb-inventory and ox_inventory invento
jc_coins/Editable/Server/SMain.lua:
Function to give rewards for the surprise boxes that are opened
function RecompensarJugador(item, xPlayer)
local inventory = Config.Inventory
if inventory == 'esx' then
if item.type == "ITEM" then
xPlayer.addInventoryItem(item.item, item.ammount or 1)
elseif item.type == "ARMA" then
xPlayer.addWeapon(item.item, 250)
elseif item.type == "DINERO" then
xPlayer.addMoney(item.ammount or 1000)
end
elseif inventory == 'qb' then
local Player = xPlayer
if item.type == "ITEM" then
Player.Functions.AddItem(item.item, item.ammount or 1)
elseif item.type == "ARMA" then
Player.Functions.AddItem(item.item, 1, false, {ammo = 250})
elseif item.type == "DINERO" then
Player.Functions.AddMoney("cash", item.ammount or 1000)
end
elseif inventory == 'ox' then
local playerId = xPlayer.source or xPlayer.PlayerData.source or xPlayer
local ox_inventory = exports.ox_inventory
if item.type == "ITEM" then
ox_inventory:AddItem(playerId, item.item, item.ammount or 1)
elseif item.type == "ARMA" then
ox_inventory:AddItem(playerId, item.item, 1, {ammo = 250})
elseif item.type == "DINERO" then
ox_inventory:AddItem(playerId, 'money', item.ammount or 1000)
end
end
end
Function to give items or articles as you want to call it, when buying in the VIP store
function EntregarArticuloComprado(item, tipo, ammount, xPlayer)
local inventory = Config.Inventory
if inventory == 'esx' then
if tipo == "ITEM" then
xPlayer.addInventoryItem(item, 1)
elseif tipo == "ARMA" then
xPlayer.addWeapon(item, 250)
elseif tipo == "DINERO" then
xPlayer.addMoney(ammount)
end
elseif inventory == 'qb' then
local Player = xPlayer
if tipo == "ITEM" then
Player.Functions.AddItem(item, 1)
elseif tipo == "ARMA" then
Player.Functions.AddItem(item, 1, false, {ammo = 250})
elseif tipo == "DINERO" then
Player.Functions.AddMoney("cash", ammount)
end
elseif inventory == 'ox' then
local playerId = xPlayer.source or xPlayer.PlayerData.source or xPlayer
local ox_inventory = exports.ox_inventory
if tipo == "ITEM" then
ox_inventory:AddItem(playerId, item, ammount or 1)
elseif tipo == "ARMA" then
ox_inventory:AddItem(playerId, item, 1, {ammo = 250})
elseif tipo == "DINERO" then
ox_inventory:AddItem(playerId, 'money', ammount or 1000)
end
end
end
Last updated