RegisterServerEvent('esx_inventoryhud:getOwnerVehicle')
AddEventHandler('esx_inventoryhud:getOwnerVehicle', function()
local _source = source
local KeyItems = {}
local xPlayer = ESX.GetPlayerFromId(source)
KeyItems = MySQL.Sync.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @identifier', {
['@identifier'] = xPlayer.identifier
})
TriggerClientEvent("esx_inventoryhud:setOwnerVehicle", _source, KeyItems)
end)
RegisterServerEvent('esx_inventoryhud:getOwnerHouse')
AddEventHandler('esx_inventoryhud:getOwnerHouse', function()
local _source = source
local HouseItems = {}
local xPlayer = ESX.GetPlayerFromId(source)
HouseItems = MySQL.Sync.fetchAll('SELECT * FROM owned_properties WHERE owner = @identifier', {
['@identifier'] = xPlayer.identifier
})
TriggerClientEvent("esx_inventoryhud:setOwnerHouse", _source, HouseItems)
end)
RegisterServerEvent('esx_inventoryhud:getOwnerAccessories')
AddEventHandler('esx_inventoryhud:getOwnerAccessories', function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(source)
local AccessoriesItems = {}
-- Accessories Helmet
local Result_Helmet = MySQL.Sync.fetchAll('SELECT * FROM meeta_accessory_inventory WHERE owner = @owner AND type = @type', {
['@owner'] = xPlayer.identifier,
['@type'] = 'player_helmet'
})
if Result_Helmet[1] then
for k,v in pairs(Result_Helmet) do
local skin = json.decode(v.skin)
table.insert(AccessoriesItems, {
label = v.label,
count = 1,
limit = -1,
type = "item_accessories",
name = "helmet",
usable = true,
rare = false,
canRemove = false,
itemnum = skin["helmet_1"],
itemskin = skin["helmet_2"]
})
end
end