forked from Simnation/Main
114 lines
3.6 KiB
Lua
114 lines
3.6 KiB
Lua
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
|
|
|
|
-- For stash inventories
|
|
if job == "stash" then
|
|
-- Make sure invId is a string
|
|
local stashId = tostring(data.id or "housing_" .. src)
|
|
|
|
exports["tgiann-inventory"]:OpenInventory(src, "stash", stashId, {
|
|
maxWeight = data.weight or 10000,
|
|
slots = data.slots or 50,
|
|
label = data.label or "Housing Stash"
|
|
})
|
|
-- For trunk inventories
|
|
elseif job == "trunk" then
|
|
-- Make sure plate is a string
|
|
local plate = tostring(data)
|
|
|
|
exports["tgiann-inventory"]:OpenInventory(src, "trunk", plate)
|
|
-- For glovebox inventories
|
|
elseif job == "glovebox" then
|
|
-- Make sure plate is a string
|
|
local plate = tostring(data)
|
|
|
|
exports["tgiann-inventory"]:OpenInventory(src, "glovebox", plate)
|
|
-- For other inventory types
|
|
else
|
|
-- Log error for unsupported inventory types
|
|
print("Unsupported inventory type: " .. job)
|
|
end
|
|
end)
|