1
0
Fork 0
forked from Simnation/Main
Main/resources/[housing]/brutal_housing/cl_utils.lua

242 lines
11 KiB
Lua
Raw Normal View History

2025-07-09 14:25:50 +02:00
ESX = Core
QBCore = Core
-- Buy here: (4€+VAT) https://store.brutalscripts.com
function notification(title, text, time, type)
if Config.BrutalNotify then
exports['brutal_notify']:SendAlert(title, text, time, type)
else
2025-08-10 20:12:41 +02:00
-- Using ox_lib for notifications
lib.notify({
title = title,
description = text,
type = type,
duration = time
})
-- Previous notification methods (commented out for reference)
-- SetNotificationTextEntry("STRING")
-- AddTextComponentString(text)
-- DrawNotification(0,1)
-- TriggerEvent('esx:showNotification', text)
-- TriggerEvent('QBCore:Notify', text, 'info', 5000)
2025-07-09 14:25:50 +02:00
-- exports['okokNotify']:Alert(title, text, time, type, false)
end
end
function TextUIFunction(type, text)
if type == 'open' then
if Config.TextUI:lower() == 'ox_lib' then
lib.showTextUI(text)
elseif Config.TextUI:lower() == 'okoktextui' then
exports['okokTextUI']:Open(text, 'darkblue', 'right')
elseif Config.TextUI:lower() == 'esxtextui' then
ESX.TextUI(text)
elseif Config.TextUI:lower() == 'qbdrawtext' then
exports['qb-core']:DrawText(text,'left')
elseif Config.TextUI:lower() == 'brutal_textui' then
exports['brutal_textui']:Open(text, "blue")
end
elseif type == 'hide' then
if Config.TextUI:lower() == 'ox_lib' then
lib.hideTextUI()
elseif Config.TextUI:lower() == 'okoktextui' then
exports['okokTextUI']:Close()
elseif Config.TextUI:lower() == 'esxtextui' then
ESX.HideUI()
elseif Config.TextUI:lower() == 'qbdrawtext' then
exports['qb-core']:HideText()
elseif Config.TextUI:lower() == 'brutal_textui' then
exports['brutal_textui']:Close()
end
end
end
function AbleToOpenThePropertiesMenu()
local able = true
if Config.BrutalPoliceJob and GetResourceState("brutal_policejob") == "started" then
if exports.brutal_policejob:IsHandcuffed() then
able = false
end
end
if Config['Core']:upper() == 'QBCORE' then
if GetResourceState("qb-policejob") == "started" then
if exports["qb-policejob"]:IsHandcuffed() then
able = false
end
end
end
-- other blacklists can be added.
return able
end
function OpenDressingMenu()
if Config.Wardrobe == 'ak47_clothing' then
exports['ak47_clothing']:openOutfit() -- if it doesn't work with this export use other event
-- TriggerEvent('ak47_clothing:openOutfitMenu') -- Use this only if the first export doesn't work, depend of you'r version
elseif Config.Wardrobe == 'codem_apperance' then
TriggerEvent('codem-apperance:OpenWardrobe')
elseif Config.Wardrobe == 'fivem_appearance' then
exports['fivem-appearance']:openWardrobe()
elseif Config.Wardrobe == 'illenium_appearance' then
TriggerEvent('illenium-appearance:client:openOutfitMenu')
elseif Config.Wardrobe == 'qb_clothing' then
TriggerEvent('qb-clothing:client:openOutfitMenu')
elseif Config.Wardrobe == 'raid_clothes' then
TriggerEvent('raid_clothes:openmenu')
elseif Config.Wardrobe == 'rcore_clothes' then
TriggerEvent('rcore_clothes:openOutfits')
elseif Config.Wardrobe == 'rcore_clothing' then
TriggerEvent('rcore_clothing:openChangingRoom')
elseif Config.Wardrobe == 'sleek_clothestore' then
exports['sleek-clothestore']:OpenWardrobe()
elseif Config.Wardrobe == 'tgiann_clothing' then
TriggerEvent('tgiann-clothing:openOutfitMenu')
end
end
function setPlayerSkin(skinTable)
if Config['Core']:upper() == 'ESX' then
TriggerEvent('skinchanger:loadSkin', skinTable.skin)
elseif Config['Core']:upper() == 'QBCORE' then
TriggerEvent("qb-clothes:loadSkin", false, tonumber(skinTable.model), skinTable.skin)
TriggerServerEvent("brutal_housing:server:qbcore-loadPlayerSkin", tonumber(skinTable.model), skinTable.skin)
end
end
function MiniGames(type, propertyID)
if type == "raid" then
if GetResourceState("ps-ui") == "started" then
exports['ps-ui']:Circle(function(success)
TriggerEvent('brutal_housing:client:raidMinigame', propertyID, success)
end, 3, 10)
else
TriggerEvent('brutal_housing:client:raidMinigame', propertyID, true)
end
elseif type == "server-destroy" then
if GetResourceState("ps-ui") == "started" then
exports['ps-ui']:Scrambler(function(success)
TriggerEvent('brutal_housing:client:serverdestroy', propertyID, success)
end, "alphanumeric", 60, 2)
else
TriggerEvent('brutal_housing:client:serverdestroy', propertyID, true)
end
elseif type == "house-break-in-level_0" then
if GetResourceState("ps-ui") == "started" then
exports['ps-ui']:Scrambler(function(success)
TriggerEvent('brutal_housing:client:breakInMinigame', propertyID, success)
end, "alphanumeric", 60, 2)
else
TriggerEvent('brutal_housing:client:breakInMinigame', propertyID, true)
end
elseif type == "house-break-in-level_1" then
if GetResourceState("ps-ui") == "started" then
exports['ps-ui']:VarHack(function(success)
TriggerEvent('brutal_housing:client:breakInMinigame', propertyID, success)
end, 10, 30)
else
TriggerEvent('brutal_housing:client:breakInMinigame', propertyID, true)
end
elseif type == "house-break-in-level_2" then
if GetResourceState("ps-ui") == "started" then
exports['ps-ui']:Thermite(function(success)
TriggerEvent('brutal_housing:client:breakInMinigame', propertyID, success)
end, 30, 6, 10)
else
TriggerEvent('brutal_housing:client:breakInMinigame', propertyID, true)
end
elseif type == "house-break-in-level_3" then
if GetResourceState("ps-ui") == "started" then
exports['ps-ui']:Thermite(function(success)
TriggerEvent('brutal_housing:client:breakInMinigame', propertyID, success)
end, 30, 6, 10)
else
TriggerEvent('brutal_housing:client:breakInMinigame', propertyID, true)
end
end
end
function PoliceBurglarNotify(x,y,z, address)
if Config.BrutalPoliceJob and GetResourceState("brutal_policejob") == "started" then
TriggerServerEvent('brutal_policejob:server:citizencall', 'create', Config.Locales.BreakIn, {x,y,z}, address)
else
SendNotify(66)
end
end
function InventoryOpenFunction(propertyID, objectID)
if Config.Inventory:lower() == 'ox_inventory' then
if exports.ox_inventory:openInventory('stash', { id = "stash_"..propertyID.."_"..objectID}) == false then
TriggerServerEvent('brutal_housing:server:loadStash', propertyID, objectID)
exports.ox_inventory:openInventory('stash', { id = "stash_"..propertyID.."_"..objectID})
end
elseif Config.Inventory:lower() == 'qb_inventory_old' then
TriggerServerEvent("inventory:server:OpenInventory", "stash", "stash_"..propertyID.."_"..objectID, {label = Config.Locales.Stash, maxweight = Config.Stash.Weight, slots = Config.Stash.Slots})
TriggerEvent("inventory:client:SetCurrentStash", "stash_"..propertyID.."_"..objectID)
elseif Config.Inventory:lower() == 'qb_inventory_new' then
TriggerServerEvent("brutal_housing:qb-inventory:server:OpenInventory", "stash_"..propertyID.."_"..objectID, {label = Config.Locales.Stash, maxweight = Config.Stash.Weight, slots = Config.Stash.Slots})
elseif Config.Inventory:lower() == 'quasar_inventory' then
TriggerServerEvent("inventory:server:OpenInventory", "stash", "stash_"..propertyID.."_"..objectID, { label = Config.Locales.Stash, maxweight = Config.Stash.Weight, slots = Config.Stash.Slots })
TriggerEvent("inventory:client:SetCurrentStash", "stash_"..propertyID.."_"..objectID)
elseif Config.Inventory:lower() == 'codem_inventory' then
TriggerServerEvent("inventory:server:OpenInventory", "stash", "stash_"..propertyID.."_"..objectID, { label = Config.Locales.Stash, maxweight = Config.Stash.Weight, slots = Config.Stash.Slots })
TriggerEvent("inventory:client:SetCurrentStash", "stash_"..propertyID.."_"..objectID)
elseif Config.Inventory:lower() == 'chezza_inventory' then
TriggerEvent('inventory:openStorage', Config.Locales.Stash, "stash_"..propertyID.."_"..objectID, 1000, 1000)
elseif Config.Inventory:lower() == 'core_inventory' then
TriggerServerEvent('core_inventory:server:openInventory', "stash_"..propertyID.."_"..objectID, "big_storage")
elseif Config.Inventory:lower() == 'origen_inventory' then
exports.origen_inventory:openInventory("stash", "stash_"..propertyID.."_"..objectID, {label = Config.Locales.Stash, maxweight = Config.Stash.Weight, slots = Config.Stash.Slots})
elseif Config.Inventory:lower() == 'ps-inventory' then
if GetResourceState('ps-inventory') == "started" then
TriggerServerEvent("ps-inventory:server:OpenInventory", "stash_"..propertyID.."_"..objectID, {label = Config.Locales.Stash, maxweight = Config.Stash.Weight, slots = Config.Stash.Slots})
TriggerEvent("ps-inventory:client:SetCurrentStash", "stash_"..propertyID.."_"..objectID)
else
TriggerServerEvent("inventory:server:OpenInventory", "stash", "stash_"..propertyID.."_"..objectID, {label = Config.Locales.Stash, maxweight = Config.Stash.Weight, slots = Config.Stash.Slots})
TriggerEvent("inventory:client:SetCurrentStash", "stash_"..propertyID.."_"..objectID)
end
end
end
RegisterNetEvent('brutal_housing:client:utils:CreateVehicle')
AddEventHandler('brutal_housing:client:utils:CreateVehicle', function(Vehicle)
SetVehicleFuelLevel(Vehicle, 100.0)
DecorSetFloat(Vehicle, "_FUEL_LEVEL", GetVehicleFuelLevel(Vehicle))
if Config['Core']:upper() == 'QBCORE' then
TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(Vehicle))
end
end)
RegisterNetEvent('brutal_housing:client:utils:DeleteVehicle')
AddEventHandler('brutal_housing:client:utils:DeleteVehicle', function(Vehicle)
DeleteEntity(Vehicle)
end)
function OpenMenuUtil()
InMenu = true
SetNuiFocus(true, true)
Citizen.CreateThread(function()
while InMenu do
N_0xf4f2c0d4ee209e20() -- it's disable the AFK camera zoom
Citizen.Wait(15000)
end
end)
DisplayRadar(false)
end
function DisableMinimap()
DisplayRadar(false)
-- Here you can add a trigger to hide your HUD system
end
function EnableMinimap()
DisplayRadar(true)
-- Here you can add a trigger to enable your HUD system
end