2025-07-09 14:25:50 +02:00
|
|
|
local Webhooks = {
|
|
|
|
create = 'YOUR-WEBHOOK', -- help: https://docs.brutalscripts.com/site/others/discord-webhook
|
|
|
|
delete = 'YOUR-WEBHOOK',
|
|
|
|
purchase = 'YOUR-WEBHOOK',
|
|
|
|
rent = 'YOUR-WEBHOOK',
|
|
|
|
ownerchange = 'YOUR-WEBHOOK',
|
|
|
|
}
|
|
|
|
|
|
|
|
function GetWebhook()
|
|
|
|
return Webhooks
|
|
|
|
end
|
|
|
|
|
|
|
|
RESCB("brutal_housing:server:GetDressing",function(source,cb)
|
|
|
|
local src = source
|
|
|
|
local dressingTable = {}
|
|
|
|
local dataArrived = false
|
|
|
|
|
|
|
|
if Config['Core']:upper() == 'ESX' then
|
|
|
|
TriggerEvent('esx_datastore:getDataStore', 'property', GetIdentifier(src), function(store)
|
|
|
|
local dressings = store.get('dressing') or {}
|
|
|
|
|
|
|
|
for k,v in pairs(dressings) do
|
|
|
|
table.insert(dressingTable, {label = v.label, skin = v.skin})
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
dataArrived = true
|
|
|
|
elseif Config['Core']:upper() == 'QBCORE' then
|
|
|
|
local results = MySQL.query.await('SELECT * FROM player_outfits WHERE citizenid = ?', { GetIdentifier(src) })
|
|
|
|
for k, v in pairs(results) do
|
|
|
|
table.insert(dressingTable, {label = v.outfitname ~= "" and v.outfitname or "None", skin = results[k].skin, model = v.model})
|
|
|
|
end
|
|
|
|
dataArrived = true
|
|
|
|
end
|
|
|
|
|
|
|
|
while not dataArrived do
|
|
|
|
Citizen.Wait(10)
|
|
|
|
end
|
|
|
|
|
|
|
|
cb(dressingTable)
|
|
|
|
end)
|
|
|
|
|
|
|
|
RegisterNetEvent("brutal_housing:server:qbcore-loadPlayerSkin")
|
|
|
|
AddEventHandler("brutal_housing:server:qbcore-loadPlayerSkin", function(model, skin)
|
|
|
|
local src = source
|
|
|
|
|
|
|
|
if model ~= nil and skin ~= nil then
|
|
|
|
MySQL.query('DELETE FROM playerskins WHERE citizenid = ?', { GetIdentifier(src) }, function()
|
|
|
|
MySQL.insert('INSERT INTO playerskins (citizenid, model, skin, active) VALUES (?, ?, ?, ?)', {
|
|
|
|
GetIdentifier(src),
|
|
|
|
model,
|
|
|
|
skin,
|
|
|
|
1
|
|
|
|
})
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
function StaffCheck(source)
|
|
|
|
local staff = false
|
|
|
|
|
|
|
|
if Config.Core:upper() == 'ESX'then
|
|
|
|
local player = Core.GetPlayerFromId(source)
|
|
|
|
local playerGroup = player.getGroup()
|
|
|
|
|
|
|
|
for i, Group in ipairs(Config.AdminGroups) do
|
|
|
|
if playerGroup == Group then
|
|
|
|
staff = true
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elseif Config.Core:upper() == 'QBCORE' then
|
|
|
|
|
|
|
|
for i, Group in ipairs(Config.AdminGroups) do
|
|
|
|
if Core.Functions.HasPermission(source, Group) or IsPlayerAceAllowed(source, Group) or IsPlayerAceAllowed(source, 'command') then
|
|
|
|
staff = true
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return staff
|
|
|
|
end
|
|
|
|
|
|
|
|
RegisterNetEvent("brutal_housing:qb-inventory:server:OpenInventory", function(job, data)
|
|
|
|
local src = source
|
2025-08-10 19:58:56 +02:00
|
|
|
|
2025-08-10 20:01:57 +02:00
|
|
|
-- Check if job contains both type and ID (like "stash_H104_17548482891")
|
|
|
|
if string.find(job, "stash_") then
|
|
|
|
-- Extract the actual stash ID by removing "stash_" prefix
|
|
|
|
local stashId = string.gsub(job, "stash_", "")
|
2025-08-10 19:58:56 +02:00
|
|
|
|
2025-08-10 20:01:57 +02:00
|
|
|
-- Open the inventory with proper parameters
|
2025-08-10 19:58:56 +02:00
|
|
|
exports["tgiann-inventory"]:OpenInventory(src, "stash", stashId, {
|
2025-08-10 19:55:34 +02:00
|
|
|
maxWeight = data.weight or 10000,
|
|
|
|
slots = data.slots or 50,
|
2025-08-10 20:01:57 +02:00
|
|
|
label = data.label or "Housing Stash " .. stashId
|
2025-08-10 19:55:34 +02:00
|
|
|
})
|
2025-08-10 20:01:57 +02:00
|
|
|
-- Handle trunk inventories
|
|
|
|
elseif string.find(job, "trunk_") then
|
|
|
|
local plate = string.gsub(job, "trunk_", "")
|
2025-08-10 19:58:56 +02:00
|
|
|
exports["tgiann-inventory"]:OpenInventory(src, "trunk", plate)
|
2025-08-10 20:01:57 +02:00
|
|
|
-- Handle glovebox inventories
|
|
|
|
elseif string.find(job, "glovebox_") then
|
|
|
|
local plate = string.gsub(job, "glovebox_", "")
|
2025-08-10 19:58:56 +02:00
|
|
|
exports["tgiann-inventory"]:OpenInventory(src, "glovebox", plate)
|
2025-08-10 20:01:57 +02:00
|
|
|
-- Handle regular inventory types
|
|
|
|
elseif job == "stash" or job == "trunk" or job == "glovebox" then
|
|
|
|
-- For cases where job and data are properly separated
|
|
|
|
local invId = tostring(data)
|
|
|
|
exports["tgiann-inventory"]:OpenInventory(src, job, invId)
|
2025-08-10 19:55:34 +02:00
|
|
|
else
|
2025-08-10 20:01:57 +02:00
|
|
|
-- Log error for truly unsupported inventory types
|
|
|
|
print("Truly unsupported inventory type: " .. job)
|
2025-08-10 19:55:34 +02:00
|
|
|
end
|
2025-08-10 19:58:56 +02:00
|
|
|
end)
|
2025-08-10 20:01:57 +02:00
|
|
|
|