housing und dj
This commit is contained in:
parent
112c7b1761
commit
10a5d168d4
731 changed files with 506993 additions and 0 deletions
|
@ -0,0 +1,13 @@
|
|||
if Config.Dispatch ~= 'default' then return end
|
||||
|
||||
function AlarmDispatch()
|
||||
local house = CurrentHouse
|
||||
-- Your alarm dispatch
|
||||
print('Alarm Dispatched', house)
|
||||
end
|
||||
|
||||
function SensorDispatch()
|
||||
local house = CurrentHouse
|
||||
-- Your sensor dispatch
|
||||
print('Sensor Dispatched', house)
|
||||
end
|
|
@ -0,0 +1,73 @@
|
|||
if Config.Dispatch ~= 'qs-dispatch' then
|
||||
return
|
||||
end
|
||||
|
||||
function AlarmDispatch()
|
||||
local house = CurrentHouse
|
||||
local playerData = exports['qs-dispatch']:GetPlayerInfo()
|
||||
|
||||
if (not playerData) then
|
||||
print("Error getting player data")
|
||||
return
|
||||
end
|
||||
|
||||
exports['qs-dispatch']:getSSURL(function(image)
|
||||
TriggerServerEvent('qs-dispatch:server:CreateDispatchCall', {
|
||||
job = { 'police', 'sheriff', 'security' },
|
||||
callLocation = playerData.coords,
|
||||
callCode = { code = 'Alarm triggered', snippet = 'House Alarm' },
|
||||
message = " House: " .. (house or "Unknown") .. " street_1: " .. (playerData.street_1 or "Unknown") .. " street_2: " .. (playerData.street_2 or "Unknown") .. " Occupant: " .. (playerData.name or "Unknown") .. " Alarm Type: House Alarm",
|
||||
flashes = false,
|
||||
image = image or nil,
|
||||
blip = {
|
||||
sprite = 488,
|
||||
scale = 1.5,
|
||||
colour = 1,
|
||||
flashes = true,
|
||||
text = 'House Alarm Triggered',
|
||||
time = (20 * 1000), --20 secs
|
||||
},
|
||||
otherData = {
|
||||
{
|
||||
text = 'Alarm triggered in residence', -- texto del dato adicional (puede haber más de uno)
|
||||
icon = 'fas fa-home', -- ícono de Font Awesome https://fontawesome.com/icons/
|
||||
}
|
||||
}
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
function SensorDispatch()
|
||||
local house = CurrentHouse
|
||||
local playerData = exports['qs-dispatch']:GetPlayerInfo()
|
||||
|
||||
if (not playerData) then
|
||||
print("Error getting player data")
|
||||
return
|
||||
end
|
||||
|
||||
exports['qs-dispatch']:getSSURL(function(image)
|
||||
TriggerServerEvent('qs-dispatch:server:CreateDispatchCall', {
|
||||
job = { 'police', 'sheriff', 'security' },
|
||||
callLocation = playerData.coords,
|
||||
callCode = { code = 'Sensor Activated', snippet = 'House Sensor' },
|
||||
message = " House: " .. house .. " street_1: " .. playerData.street_1 .. " street_2: " .. playerData.street_2 .. " Occupant: " .. playerData.name .. " Sensor Type: Motion Sensor Activated",
|
||||
flashes = false,
|
||||
image = image or nil,
|
||||
blip = {
|
||||
sprite = 488,
|
||||
scale = 1.5,
|
||||
colour = 1,
|
||||
flashes = true,
|
||||
text = 'Motion Sensor Activated',
|
||||
time = (20 * 1000), --20 secs
|
||||
},
|
||||
otherData = {
|
||||
{
|
||||
text = 'Motion detected in residence', -- texto del dato adicional (puede haber más de uno)
|
||||
icon = 'fas fa-eye', -- ícono de Font Awesome https://fontawesome.com/icons/
|
||||
}
|
||||
}
|
||||
})
|
||||
end)
|
||||
end
|
191
resources/[housing]/qs-housing/client/custom/framework/esx.lua
Normal file
191
resources/[housing]/qs-housing/client/custom/framework/esx.lua
Normal file
|
@ -0,0 +1,191 @@
|
|||
if Config.Framework ~= 'esx' then
|
||||
return
|
||||
end
|
||||
|
||||
ESX = exports['es_extended']:getSharedObject()
|
||||
|
||||
CreateThread(function()
|
||||
PlayerData = GetPlayerData()
|
||||
Debug('init playerData')
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setJob', function(jobData)
|
||||
PlayerData.job = jobData
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
AddEventHandler('esx:playerLoaded', function(playerData)
|
||||
PlayerData = playerData
|
||||
IsLoggedIn = true
|
||||
Wait(2500)
|
||||
TriggerServerCallback('qb-houses:GetInside', function(currentHouse)
|
||||
Debug('qb-houses:GetInside', currentHouse)
|
||||
if currentHouse and currentHouse ~= 'nil' and currentHouse ~= '' then
|
||||
Wait(100)
|
||||
TriggerEvent('qb-houses:client:LastLocationHouse', currentHouse)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:playerLogout')
|
||||
AddEventHandler('esx:playerLogout', function()
|
||||
IsLoggedIn = false
|
||||
CurrentHouseData = {}
|
||||
DeleteBlips()
|
||||
end)
|
||||
|
||||
function TriggerServerCallback(name, cb, ...)
|
||||
ESX.TriggerServerCallback(name, cb, ...)
|
||||
end
|
||||
|
||||
function GetPlayerData()
|
||||
return ESX.GetPlayerData()
|
||||
end
|
||||
|
||||
function GetIdentifier()
|
||||
return GetPlayerData().identifier
|
||||
end
|
||||
|
||||
function GetJobName()
|
||||
return PlayerData?.job?.name or 'unemployed'
|
||||
end
|
||||
|
||||
function GetPlayers()
|
||||
return ESX.Game.GetPlayers()
|
||||
end
|
||||
|
||||
function GetVehicleProperties(vehicle)
|
||||
return ESX.Game.GetVehicleProperties(vehicle)
|
||||
end
|
||||
|
||||
function ShowHelpNotification(msg)
|
||||
BeginTextCommandDisplayHelp('STRING')
|
||||
AddTextComponentSubstringPlayerName(msg)
|
||||
EndTextCommandDisplayHelp(0, false, true, -1)
|
||||
end
|
||||
|
||||
local texts = {}
|
||||
if GetResourceState('qs-textui') == 'started' then
|
||||
function DrawText3D(x, y, z, text, id, key)
|
||||
local _id = id
|
||||
if not texts[_id] then
|
||||
CreateThread(function()
|
||||
texts[_id] = 5
|
||||
while texts[_id] > 0 do
|
||||
texts[_id] = texts[_id] - 1
|
||||
Wait(0)
|
||||
end
|
||||
texts[_id] = nil
|
||||
exports['qs-textui']:DeleteDrawText3D(id)
|
||||
Debug('Deleted text', id)
|
||||
end)
|
||||
TriggerEvent('textui:DrawText3D', x, y, z, text, id, key)
|
||||
end
|
||||
texts[_id] = 5
|
||||
end
|
||||
else
|
||||
function DrawText3D(x, y, z, text)
|
||||
SetTextScale(0.35, 0.35)
|
||||
SetTextFont(4)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(255, 255, 255, 215)
|
||||
SetTextEntry('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
local factor = text:len() / 370
|
||||
DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
end
|
||||
|
||||
function DrawText3Ds(x, y, z, text)
|
||||
SetTextScale(0.35, 0.35)
|
||||
SetTextFont(4)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(255, 255, 255, 215)
|
||||
SetTextEntry('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
local factor = text:len() / 370
|
||||
DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
|
||||
function DrawTextBoard(x, y, z, text)
|
||||
SetTextScale(0.45, 0.45)
|
||||
SetTextFont(1)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(0, 0, 0, 215)
|
||||
SetTextEntry('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
|
||||
function DrawGenericText(text)
|
||||
SetTextColour(186, 186, 186, 255)
|
||||
SetTextFont(4)
|
||||
SetTextScale(0.5, 0.5)
|
||||
SetTextWrap(0.0, 1.0)
|
||||
SetTextCentre(false)
|
||||
SetTextDropshadow(0, 0, 0, 0, 255)
|
||||
SetTextEdge(1, 0, 0, 0, 205)
|
||||
SetTextEntry('STRING')
|
||||
AddTextComponentString(text)
|
||||
DrawText(0.40, 0.00)
|
||||
end
|
||||
|
||||
function Notification(msg, type)
|
||||
if GetResourceState('qs-interface') == 'started' then
|
||||
if type == 'inform' then
|
||||
exports['qs-interface']:AddNotify(msg, 'Inform', 2500, 'fas fa-file')
|
||||
elseif type == 'error' then
|
||||
exports['qs-interface']:AddNotify(msg, 'Error', 2500, 'fas fa-bug')
|
||||
elseif type == 'success' then
|
||||
exports['qs-interface']:AddNotify(msg, 'Success', 2500, 'fas fa-thumbs-up')
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if type == 'inform' then
|
||||
lib.notify({
|
||||
title = 'Housing',
|
||||
description = msg,
|
||||
type = 'inform'
|
||||
})
|
||||
elseif type == 'error' then
|
||||
lib.notify({
|
||||
title = 'Housing',
|
||||
description = msg,
|
||||
type = 'error'
|
||||
})
|
||||
elseif type == 'success' then
|
||||
lib.notify({
|
||||
title = 'Housing',
|
||||
description = msg,
|
||||
type = 'success'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function ToggleHud(bool)
|
||||
if bool then
|
||||
Debug('Event to show the hud [client/custom/framework/esx.lua line 177]')
|
||||
-- DisplayRadar(false) -- You can enable or disable mini-map here
|
||||
if GetResourceState('qs-interface') == 'started' then
|
||||
exports['qs-interface']:ToggleHud(false)
|
||||
end
|
||||
else
|
||||
Debug('Event to hide the hud [client/custom/framework/esx.lua line 177]')
|
||||
-- DisplayRadar(true) -- You can enable or disable mini-map here
|
||||
if GetResourceState('qs-interface') == 'started' then
|
||||
exports['qs-interface']:ToggleHud(true)
|
||||
end
|
||||
end
|
||||
end
|
188
resources/[housing]/qs-housing/client/custom/framework/qb.lua
Normal file
188
resources/[housing]/qs-housing/client/custom/framework/qb.lua
Normal file
|
@ -0,0 +1,188 @@
|
|||
if Config.Framework ~= 'qb' then
|
||||
return
|
||||
end
|
||||
|
||||
QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
CreateThread(function()
|
||||
PlayerData = GetPlayerData()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded')
|
||||
AddEventHandler('QBCore:Client:OnPlayerLoaded', function(playerData)
|
||||
PlayerData = GetPlayerData()
|
||||
IsLoggedIn = true
|
||||
Wait(1000)
|
||||
local currentHouseId = QBCore.Functions.GetPlayerData().metadata['currentHouseId']
|
||||
Debug('inside meta', currentHouseId)
|
||||
if currentHouseId then
|
||||
TriggerEvent('qb-houses:client:LastLocationHouse', currentHouseId)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(jobData)
|
||||
PlayerData.job = jobData
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerUnload')
|
||||
AddEventHandler('QBCore:Client:OnPlayerUnload', function()
|
||||
IsLoggedIn = false
|
||||
CurrentHouseData = {}
|
||||
DeleteBlips()
|
||||
end)
|
||||
|
||||
function TriggerServerCallback(name, cb, ...)
|
||||
QBCore.Functions.TriggerCallback(name, cb, ...)
|
||||
end
|
||||
|
||||
function GetPlayerData()
|
||||
return QBCore.Functions.GetPlayerData()
|
||||
end
|
||||
|
||||
function GetIdentifier()
|
||||
return GetPlayerData().citizenid
|
||||
end
|
||||
|
||||
function GetJobName()
|
||||
return PlayerData?.job?.name or 'unemployed'
|
||||
end
|
||||
|
||||
function GetPlayers()
|
||||
return QBCore.Functions.GetPlayers()
|
||||
end
|
||||
|
||||
function GetVehicleProperties(vehicle)
|
||||
return QBCore.Functions.GetVehicleProperties(vehicle)
|
||||
end
|
||||
|
||||
function ShowHelpNotification(msg)
|
||||
BeginTextCommandDisplayHelp('STRING')
|
||||
AddTextComponentSubstringPlayerName(msg)
|
||||
EndTextCommandDisplayHelp(0, false, true, -1)
|
||||
end
|
||||
|
||||
local texts = {}
|
||||
if GetResourceState('qs-textui') == 'started' then
|
||||
function DrawText3D(x, y, z, text, id, key)
|
||||
local _id = id
|
||||
if not texts[_id] then
|
||||
CreateThread(function()
|
||||
texts[_id] = 5
|
||||
while texts[_id] > 0 do
|
||||
texts[_id] = texts[_id] - 1
|
||||
Wait(0)
|
||||
end
|
||||
texts[_id] = nil
|
||||
exports['qs-textui']:DeleteDrawText3D(id)
|
||||
Debug('Deleted text', id)
|
||||
end)
|
||||
TriggerEvent('textui:DrawText3D', x, y, z, text, id, key)
|
||||
end
|
||||
texts[_id] = 5
|
||||
end
|
||||
else
|
||||
function DrawText3D(x, y, z, text)
|
||||
SetTextScale(0.35, 0.35)
|
||||
SetTextFont(4)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(255, 255, 255, 215)
|
||||
SetTextEntry('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
local factor = text:len() / 370
|
||||
DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
end
|
||||
|
||||
function DrawText3Ds(x, y, z, text)
|
||||
SetTextScale(0.35, 0.35)
|
||||
SetTextFont(4)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(255, 255, 255, 215)
|
||||
SetTextEntry('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
local factor = text:len() / 370
|
||||
DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
|
||||
function DrawTextBoard(x, y, z, text)
|
||||
SetTextScale(0.45, 0.45)
|
||||
SetTextFont(1)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(0, 0, 0, 215)
|
||||
SetTextEntry('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
|
||||
function DrawGenericText(text)
|
||||
SetTextColour(186, 186, 186, 255)
|
||||
SetTextFont(4)
|
||||
SetTextScale(0.5, 0.5)
|
||||
SetTextWrap(0.0, 1.0)
|
||||
SetTextCentre(false)
|
||||
SetTextDropshadow(0, 0, 0, 0, 255)
|
||||
SetTextEdge(1, 0, 0, 0, 205)
|
||||
SetTextEntry('STRING')
|
||||
AddTextComponentString(text)
|
||||
DrawText(0.40, 0.00)
|
||||
end
|
||||
|
||||
function Notification(msg, type)
|
||||
if GetResourceState('qs-interface') == 'started' then
|
||||
if type == 'inform' then
|
||||
exports['qs-interface']:AddNotify(msg, 'Inform', 2500, 'fas fa-file')
|
||||
elseif type == 'error' then
|
||||
exports['qs-interface']:AddNotify(msg, 'Error', 2500, 'fas fa-bug')
|
||||
elseif type == 'success' then
|
||||
exports['qs-interface']:AddNotify(msg, 'Success', 2500, 'fas fa-thumbs-up')
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if type == 'inform' then
|
||||
lib.notify({
|
||||
title = 'Housing',
|
||||
description = msg,
|
||||
type = 'inform'
|
||||
})
|
||||
elseif type == 'error' then
|
||||
lib.notify({
|
||||
title = 'Housing',
|
||||
description = msg,
|
||||
type = 'error'
|
||||
})
|
||||
elseif type == 'success' then
|
||||
lib.notify({
|
||||
title = 'Housing',
|
||||
description = msg,
|
||||
type = 'success'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function ToggleHud(bool)
|
||||
if bool then
|
||||
Debug('Event to show the hud [client/custom/framework/esx.lua line 174]')
|
||||
-- DisplayRadar(false) -- You can enable or disable mini-map here
|
||||
if GetResourceState('qs-interface') == 'started' then
|
||||
exports['qs-interface']:ToggleHud(false)
|
||||
end
|
||||
else
|
||||
Debug('Event to hide the hud [client/custom/framework/esx.lua line 174]')
|
||||
-- DisplayRadar(true) -- You can enable or disable mini-map here
|
||||
if GetResourceState('qs-interface') == 'started' then
|
||||
exports['qs-interface']:ToggleHud(true)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,203 @@
|
|||
if Config.Framework ~= 'standalone' then return end
|
||||
|
||||
local RequestId = 0
|
||||
local serverRequests = {}
|
||||
|
||||
local clientCallbacks = {}
|
||||
|
||||
---@param eventName string
|
||||
---@param callback function
|
||||
---@param ... any
|
||||
TriggerServerCallback = function(eventName, callback, ...)
|
||||
serverRequests[RequestId] = callback
|
||||
|
||||
TriggerServerEvent('houses:triggerServerCallback', eventName, RequestId, GetInvokingResource() or 'unknown', ...)
|
||||
|
||||
RequestId = RequestId + 1
|
||||
end
|
||||
|
||||
exports('TriggerServerCallback', TriggerServerCallback)
|
||||
|
||||
RegisterNetEvent('houses:serverCallback', function(requestId, invoker, ...)
|
||||
if not serverRequests[requestId] then
|
||||
return print(('[^1ERROR^7] Server Callback with requestId ^5%s^7 Was Called by ^5%s^7 but does not exist.'):format(requestId, invoker))
|
||||
end
|
||||
|
||||
serverRequests[requestId](...)
|
||||
serverRequests[requestId] = nil
|
||||
end)
|
||||
|
||||
---@param eventName string
|
||||
---@param callback function
|
||||
_RegisterClientCallback = function(eventName, callback)
|
||||
clientCallbacks[eventName] = callback
|
||||
end
|
||||
|
||||
RegisterNetEvent('houses:triggerClientCallback', function(eventName, requestId, invoker, ...)
|
||||
if not clientCallbacks[eventName] then
|
||||
return print(('[^1ERROR^7] Client Callback not registered, name: ^5%s^7, invoker resource: ^5%s^7'):format(eventName, invoker))
|
||||
end
|
||||
|
||||
clientCallbacks[eventName](function(...)
|
||||
TriggerServerEvent('houses:clientCallback', requestId, invoker, ...)
|
||||
end, ...)
|
||||
end)
|
||||
|
||||
function GetPlayerData()
|
||||
Error('GetPlayerData is not implemented in standalone framework')
|
||||
return {}
|
||||
end
|
||||
|
||||
local playerIdentifier = nil
|
||||
|
||||
function GetIdentifier()
|
||||
if playerIdentifier then
|
||||
return playerIdentifier
|
||||
end
|
||||
local identifier = TriggerServerCallbackSync('houses:GetIdentifier')
|
||||
if identifier then
|
||||
playerIdentifier = identifier
|
||||
end
|
||||
return identifier
|
||||
end
|
||||
|
||||
function GetJobName()
|
||||
Error('GetJobName is used with standalone')
|
||||
return 'police'
|
||||
end
|
||||
|
||||
function GetPlayers()
|
||||
return TriggerServerCallbackSync('houses:GetPlayers')
|
||||
end
|
||||
|
||||
function ShowHelpNotification(msg)
|
||||
BeginTextCommandDisplayHelp('STRING')
|
||||
AddTextComponentSubstringPlayerName(msg)
|
||||
EndTextCommandDisplayHelp(0, false, true, -1)
|
||||
end
|
||||
|
||||
local texts = {}
|
||||
if GetResourceState('qs-textui') == 'started' then
|
||||
function DrawText3D(x, y, z, text, id, key)
|
||||
local _id = id
|
||||
if not texts[_id] then
|
||||
CreateThread(function()
|
||||
texts[_id] = 5
|
||||
while texts[_id] > 0 do
|
||||
texts[_id] = texts[_id] - 1
|
||||
Wait(0)
|
||||
end
|
||||
texts[_id] = nil
|
||||
exports['qs-textui']:DeleteDrawText3D(id)
|
||||
Debug('Deleted text', id)
|
||||
end)
|
||||
TriggerEvent('textui:DrawText3D', x, y, z, text, id, key)
|
||||
end
|
||||
texts[_id] = 5
|
||||
end
|
||||
else
|
||||
function DrawText3D(x, y, z, text)
|
||||
SetTextScale(0.35, 0.35)
|
||||
SetTextFont(4)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(255, 255, 255, 215)
|
||||
SetTextEntry('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
local factor = text:len() / 370
|
||||
DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
end
|
||||
|
||||
function DrawText3Ds(x, y, z, text)
|
||||
SetTextScale(0.35, 0.35)
|
||||
SetTextFont(4)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(255, 255, 255, 215)
|
||||
SetTextEntry('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
local factor = text:len() / 370
|
||||
DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
|
||||
function DrawTextBoard(x, y, z, text)
|
||||
SetTextScale(0.45, 0.45)
|
||||
SetTextFont(1)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(0, 0, 0, 215)
|
||||
SetTextEntry('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
|
||||
function DrawGenericText(text)
|
||||
SetTextColour(186, 186, 186, 255)
|
||||
SetTextFont(4)
|
||||
SetTextScale(0.5, 0.5)
|
||||
SetTextWrap(0.0, 1.0)
|
||||
SetTextCentre(false)
|
||||
SetTextDropshadow(0, 0, 0, 0, 255)
|
||||
SetTextEdge(1, 0, 0, 0, 205)
|
||||
SetTextEntry('STRING')
|
||||
AddTextComponentString(text)
|
||||
DrawText(0.40, 0.00)
|
||||
end
|
||||
|
||||
function Notification(msg, type)
|
||||
if GetResourceState('qs-interface') == 'started' then
|
||||
if type == 'inform' then
|
||||
exports['qs-interface']:AddNotify(msg, 'Inform', 2500, 'fas fa-file')
|
||||
elseif type == 'error' then
|
||||
exports['qs-interface']:AddNotify(msg, 'Error', 2500, 'fas fa-bug')
|
||||
elseif type == 'success' then
|
||||
exports['qs-interface']:AddNotify(msg, 'Success', 2500, 'fas fa-thumbs-up')
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if type == 'inform' then
|
||||
lib.notify({
|
||||
title = 'Housing',
|
||||
description = msg,
|
||||
type = 'inform'
|
||||
})
|
||||
elseif type == 'error' then
|
||||
lib.notify({
|
||||
title = 'Housing',
|
||||
description = msg,
|
||||
type = 'error'
|
||||
})
|
||||
elseif type == 'success' then
|
||||
lib.notify({
|
||||
title = 'Housing',
|
||||
description = msg,
|
||||
type = 'success'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function ToggleHud(bool)
|
||||
if bool then
|
||||
Debug('Event to show the hud [client/custom/framework/esx.lua line 189]')
|
||||
-- DisplayRadar(false) -- You can enable or disable mini-map here
|
||||
if GetResourceState('qs-interface') == 'started' then
|
||||
exports['qs-interface']:ToggleHud(false)
|
||||
end
|
||||
else
|
||||
Debug('Event to hide the hud [client/custom/framework/esx.lua line 189]')
|
||||
-- DisplayRadar(true) -- You can enable or disable mini-map here
|
||||
if GetResourceState('qs-interface') == 'started' then
|
||||
exports['qs-interface']:ToggleHud(true)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,48 @@
|
|||
if Config.Garage ~= 'RxGarages' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage() end
|
||||
|
||||
function StoreVehicle(UniqueHouseId)
|
||||
exports['RxGarages']:ParkVehicle("House Garage ("..tostring(UniqueHouseId)..")", 'garage', 'car')
|
||||
end
|
||||
|
||||
function OpenGarage(UniqueHouseId, coords)
|
||||
exports['RxGarages']:OpenGarage("House Garage ("..tostring(UniqueHouseId)..")", 'garage', 'car', coords)
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
|
||||
if CurrentHouse ~= nil and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked) and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage then
|
||||
local garage = Config.Houses[CurrentHouse].garage
|
||||
local dist = GetDistanceBetweenCoords(pos, garage.x, garage.y, garage.z, true)
|
||||
|
||||
if dist < 5.0 then
|
||||
DrawMarker(20, garage.x, garage.y, garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
|
||||
|
||||
if dist < 2.0 then
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
|
||||
if vehicle and vehicle ~= 0 then
|
||||
DrawText3D(garage.x, garage.y, garage.z + 0.3, 'GARAGE', 'open_garage1', 'E')
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
StoreVehicle(CurrentHouse)
|
||||
end
|
||||
else
|
||||
DrawText3D(garage.x, garage.y, garage.z + 0.3, 'GARAGE', 'open_garage2', 'E')
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
OpenGarage(CurrentHouse, vector3(garage.x, garage.y, garage.z))
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,51 @@
|
|||
if Config.Garage ~= 'ak47_garage' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage() end
|
||||
|
||||
function StoreVehicle(UniqueHouseId)
|
||||
TriggerEvent('ak47_garage:housing:storevehicle', UniqueHouseId, 'car') -- car, boat, heli, plane
|
||||
end
|
||||
|
||||
function OpenGarage(UniqueHouseId)
|
||||
TriggerEvent('ak47_garage:housing:takevehicle', UniqueHouseId, 'car') -- car, boat, heli, plane
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
|
||||
if CurrentHouse ~= nil and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked) and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage then
|
||||
local dist = GetDistanceBetweenCoords(pos, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z, true)
|
||||
|
||||
if dist < 5.0 then
|
||||
DrawMarker(20, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
|
||||
|
||||
if dist < 2.0 then
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
if Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x and Config.Houses[CurrentHouse].garage.y and Config.Houses[CurrentHouse].garage.z then
|
||||
if vehicle and vehicle ~= 0 then
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'GARAGE', 'open_garage1', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not StoreVehicle then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
StoreVehicle(CurrentHouse)
|
||||
end
|
||||
else
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'GARAGE', 'open_garage2', 'E')
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not OpenGarage then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
OpenGarage(CurrentHouse)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,56 @@
|
|||
if Config.Garage ~= 'ak47_qb_garage' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage() end
|
||||
|
||||
-- Se asume que estas funciones están definidas previamente
|
||||
function StoreVehicle(UniqueHouseId)
|
||||
TriggerEvent('ak47_qb_garage:housing:storevehicle', UniqueHouseId, 'car') -- car, boat, heli, plane
|
||||
end
|
||||
|
||||
function OpenGarage(UniqueHouseId)
|
||||
TriggerEvent('ak47_qb_garage:housing:takevehicle', UniqueHouseId, 'car') -- car, boat, heli, plane
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
|
||||
if CurrentHouse ~= nil and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked) and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage then
|
||||
local dist = GetDistanceBetweenCoords(pos, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z, true)
|
||||
|
||||
if dist < 5.0 then
|
||||
DrawMarker(20, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
|
||||
|
||||
if dist < 2.0 then
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
if Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x and Config.Houses[CurrentHouse].garage.y and Config.Houses[CurrentHouse].garage.z then
|
||||
if vehicle and vehicle ~= 0 then
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'GARAGE', 'open_garage1', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) then
|
||||
if not StoreVehicle then
|
||||
return print('Your client/custom/garages/*.lua is not correctly configured')
|
||||
end
|
||||
StoreVehicle(CurrentHouse)
|
||||
end
|
||||
else
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'GARAGE', 'open_garage2', 'E')
|
||||
if IsControlJustPressed(0, Keys['E']) then
|
||||
if not OpenGarage then
|
||||
return print('Your client/custom/garages/*.lua is not correctly configured')
|
||||
end
|
||||
OpenGarage(CurrentHouse)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,57 @@
|
|||
--[[
|
||||
In this section you will find the configuration of the garage that you have selected, in
|
||||
case your system is not found here, you can ask the creator of your garage to add its exports
|
||||
in any of these files, or use these files to create your own, that would help our community!
|
||||
]]
|
||||
|
||||
if Config.Garage ~= 'cd_garage' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage() end
|
||||
|
||||
function StoreVehicle(house)
|
||||
TriggerEvent('cd_garage:StoreVehicle_Main', 1, false, false)
|
||||
end
|
||||
|
||||
function OpenGarage(house)
|
||||
TriggerEvent('cd_garage:PropertyGarage', 'quick', nil)
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
|
||||
if CurrentHouse ~= nil and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked) and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage then
|
||||
local dist = GetDistanceBetweenCoords(pos, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z, true)
|
||||
|
||||
if dist < 5.0 then
|
||||
DrawMarker(20, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
|
||||
|
||||
if dist < 2.0 then
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
if Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x and Config.Houses[CurrentHouse].garage.y and Config.Houses[CurrentHouse].garage.z then
|
||||
if vehicle and vehicle ~= 0 then
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage1', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not StoreVehicle then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
StoreVehicle(CurrentHouse)
|
||||
end
|
||||
else
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage2', 'E')
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not OpenGarage then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
OpenGarage(CurrentHouse)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,59 @@
|
|||
--[[
|
||||
In this section you will find the configuration of the garage that you have selected, in
|
||||
case your system is not found here, you can ask the creator of your garage to add its exports
|
||||
in any of these files, or use these files to create your own, that would help our community!
|
||||
]]
|
||||
|
||||
if Config.Garage ~= 'codem-garage' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage() end
|
||||
|
||||
function StoreVehicle(house)
|
||||
print(house)
|
||||
TriggerEvent('codem-garage:storeVehicle', 'House Garage')
|
||||
end
|
||||
|
||||
function OpenGarage(house)
|
||||
print(house)
|
||||
TriggerEvent('codem-garage:openHouseGarage', 'House Garage')
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
|
||||
if CurrentHouse ~= nil and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked) and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage then
|
||||
local dist = GetDistanceBetweenCoords(pos, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z, true)
|
||||
|
||||
if dist < 5.0 then
|
||||
DrawMarker(20, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
|
||||
|
||||
if dist < 2.0 then
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
if Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x and Config.Houses[CurrentHouse].garage.y and Config.Houses[CurrentHouse].garage.z then
|
||||
if vehicle and vehicle ~= 0 then
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage1', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not StoreVehicle then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
StoreVehicle(CurrentHouse)
|
||||
end
|
||||
else
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage2', 'E')
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not OpenGarage then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
OpenGarage(CurrentHouse)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,141 @@
|
|||
--[[
|
||||
|
||||
qs-housing custom garage integration with cs-garages
|
||||
Make sure your Config.Garage = 'cs-garages' in qs-housing config
|
||||
|
||||
This ensures qs-housing loads this file instead of others.
|
||||
|
||||
]]
|
||||
|
||||
if Config.Garage ~= 'cs-garages' then
|
||||
return
|
||||
end
|
||||
|
||||
local Keys = {
|
||||
['E'] = 38
|
||||
}
|
||||
|
||||
function TriggerHouseUpdateGarage() end
|
||||
|
||||
local function canUseGarage()
|
||||
return exports['cs-garages']:canOpenGarage()
|
||||
end
|
||||
|
||||
local function setGarageCooldown()
|
||||
exports['cs-garages']:setGarageCooldown()
|
||||
end
|
||||
|
||||
function StoreVehicle(houseId)
|
||||
local hData = Config.Houses[houseId]
|
||||
if not hData or not hData.garage then return end
|
||||
|
||||
local gx, gy, gz, gh = hData.garage.x, hData.garage.y, hData.garage.z, (hData.garage.h or 0.0)
|
||||
|
||||
TriggerEvent('cs-garages:client:StoreHouseVehicle', houseId, 'car', gx, gy, gz, gh)
|
||||
|
||||
setGarageCooldown()
|
||||
end
|
||||
|
||||
function OpenGarage(houseId)
|
||||
local hData = Config.Houses[houseId]
|
||||
if not hData or not hData.garage then return end
|
||||
|
||||
local gx, gy, gz, gh = hData.garage.x, hData.garage.y, hData.garage.z, (hData.garage.h or 0.0)
|
||||
|
||||
TriggerEvent('cs-garages:client:OpenHouseGarage', houseId, 'car', gx, gy, gz, gh)
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
|
||||
if CurrentHouse ~= nil
|
||||
and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked)
|
||||
and Config.Houses
|
||||
and Config.Houses[CurrentHouse]
|
||||
and Config.Houses[CurrentHouse].garage then
|
||||
local g = Config.Houses[CurrentHouse].garage
|
||||
local dist = #(pos - vector3(g.x, g.y, g.z))
|
||||
|
||||
if dist < 5.0 then
|
||||
local veh = GetVehiclePedIsIn(ped, false)
|
||||
|
||||
if veh ~= 0 then
|
||||
DrawMarker(
|
||||
20,
|
||||
g.x, g.y, g.z + 0.3,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0.6, 0.4, 0.3,
|
||||
255, 0, 0, 122,
|
||||
false, false, 0, true, false, false, false
|
||||
)
|
||||
else
|
||||
DrawMarker(
|
||||
20,
|
||||
g.x, g.y, g.z + 0.3,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0.6, 0.4, 0.3,
|
||||
30, 150, 30, 122,
|
||||
false, false, 0, true, false, false, false
|
||||
)
|
||||
end
|
||||
|
||||
if dist < 2.0 then
|
||||
if veh ~= 0 then
|
||||
DrawText3D(g.x, g.y, g.z + 0.3, '[E] Store Vehicle')
|
||||
if IsControlJustPressed(0, Keys['E']) then
|
||||
if not canUseGarage() then
|
||||
lib.notify({
|
||||
title = 'Garage',
|
||||
description = 'You recently stored a vehicle in the garage, please wait a moment.',
|
||||
position = 'bottom-center',
|
||||
type = 'inform',
|
||||
style = {
|
||||
borderRadius = 16,
|
||||
backgroundColor = '#0f172a',
|
||||
color = '#f8fafc',
|
||||
border = '1px solid #334155',
|
||||
padding = '12px 20px',
|
||||
fontFamily = 'Inter, sans-serif'
|
||||
},
|
||||
icon = 'info',
|
||||
iconColor = '#053BFB'
|
||||
})
|
||||
else
|
||||
StoreVehicle(CurrentHouse)
|
||||
end
|
||||
end
|
||||
else
|
||||
DrawText3D(g.x, g.y, g.z + 0.3, '[E] Open Garage')
|
||||
if IsControlJustPressed(0, Keys['E']) then
|
||||
if not canUseGarage() then
|
||||
lib.notify({
|
||||
title = 'Garage',
|
||||
description = 'You recently opened the garage, please wait a moment.',
|
||||
position = 'bottom-center',
|
||||
type = 'inform',
|
||||
style = {
|
||||
borderRadius = 16,
|
||||
backgroundColor = '#0f172a',
|
||||
color = '#f8fafc',
|
||||
border = '1px solid #334155',
|
||||
padding = '12px 20px',
|
||||
fontFamily = 'Inter, sans-serif'
|
||||
},
|
||||
icon = 'info',
|
||||
iconColor = '#053BFB'
|
||||
})
|
||||
else
|
||||
OpenGarage(CurrentHouse)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,57 @@
|
|||
--[[
|
||||
In this section you will find the configuration of the garage that you have selected, in
|
||||
case your system is not found here, you can ask the creator of your garage to add its exports
|
||||
in any of these files, or use these files to create your own, that would help our community!
|
||||
]]
|
||||
|
||||
if Config.Garage ~= 'jg-advancedgarages' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage() end
|
||||
|
||||
function StoreVehicle(house)
|
||||
TriggerEvent('jg-advancedgarages:client:InsertVehicle', house, true)
|
||||
end
|
||||
|
||||
function OpenGarage(house)
|
||||
TriggerEvent('jg-advancedgarages:client:ShowHouseGarage:qs-housing', house)
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
|
||||
if CurrentHouse ~= nil and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked) and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage then
|
||||
local dist = GetDistanceBetweenCoords(pos, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z, true)
|
||||
|
||||
if dist < 5.0 then
|
||||
DrawMarker(20, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
|
||||
|
||||
if dist < 2.0 then
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
if Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x and Config.Houses[CurrentHouse].garage.y and Config.Houses[CurrentHouse].garage.z then
|
||||
if vehicle and vehicle ~= 0 then
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage1', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not StoreVehicle then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
StoreVehicle(CurrentHouse)
|
||||
end
|
||||
else
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage2', 'E')
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not OpenGarage then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
OpenGarage(CurrentHouse)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,68 @@
|
|||
--[[
|
||||
In this section you will find the configuration of the garage that you have selected, in
|
||||
case your system is not found here, you can ask the creator of your garage to add its exports
|
||||
in any of these files, or use these files to create your own, that would help our community!
|
||||
]]
|
||||
|
||||
if Config.Garage ~= 'loaf_garage' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage() end
|
||||
|
||||
function StoreVehicle(house)
|
||||
local garage = house
|
||||
local vehicle = GetVehiclePedIsUsing(PlayerPedId())
|
||||
if DoesEntityExist(vehicle) and garage then
|
||||
local vehprops = GetVehicleProperties(vehicle)
|
||||
local damages = {}
|
||||
TriggerServerEvent('loaf_garage:storeVehicle', garage, damages, vehprops)
|
||||
DeleteVehicle(vehicle)
|
||||
TriggerEvent('loaf_garage:deleteStoredVehicle', GetVehicleNumberPlateText(vehicle))
|
||||
FreezeEntityPosition(PlayerPedId(-1), false)
|
||||
end
|
||||
end
|
||||
|
||||
function OpenGarage(house)
|
||||
TriggerEvent('loaf_garage:viewVehicles', house, GetEntityCoords(GetPlayerPed(-1)), GetEntityHeading(GetPlayerPed(-1)), function()
|
||||
FreezeEntityPosition(PlayerPedId(-1), false)
|
||||
end, false)
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
|
||||
if CurrentHouse ~= nil and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked) and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage then
|
||||
local dist = GetDistanceBetweenCoords(pos, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z, true)
|
||||
|
||||
if dist < 5.0 then
|
||||
DrawMarker(20, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
|
||||
|
||||
if dist < 2.0 then
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
if Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x and Config.Houses[CurrentHouse].garage.y and Config.Houses[CurrentHouse].garage.z then
|
||||
if vehicle and vehicle ~= 0 then
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage1', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not StoreVehicle then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
StoreVehicle(CurrentHouse)
|
||||
end
|
||||
else
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage2', 'E')
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not OpenGarage then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
OpenGarage(CurrentHouse)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,57 @@
|
|||
if Config.Garage ~= 'msk_garage' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage()
|
||||
return
|
||||
end
|
||||
|
||||
function OpenGarage(house)
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local heading = GetEntityHeading(PlayerPedId())
|
||||
exports.msk_garage:openGarage({
|
||||
label = house,
|
||||
garageId = house,
|
||||
parkInCoords = coords,
|
||||
parkOutCoords = {
|
||||
vec4(coords.x, coords.y, coords.z, heading)
|
||||
},
|
||||
distance = 20.0, -- Park In Radius
|
||||
warp = false, -- Teleport into vehicle
|
||||
type = { 'car', 'truck' } -- 'car', 'truck', 'airplane', ...
|
||||
})
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(PlayerPedId())
|
||||
if ped and CurrentHouse ~= nil and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked) and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x then
|
||||
local dist = #(pos - vector3(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z))
|
||||
if dist < 5.0 then
|
||||
DrawMarker(20, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
|
||||
if dist < 2.0 then
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
if Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x and Config.Houses[CurrentHouse].garage.y and Config.Houses[CurrentHouse].garage.z then
|
||||
if vehicle and vehicle ~= 0 then
|
||||
DrawText3Ds(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, Lang('HOUSING_DRAWTEXT_GARAGE_STORE'), 'open_garage1', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
--OpenGarage(CurrentHouse)
|
||||
end
|
||||
else
|
||||
DrawText3Ds(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, Lang('HOUSING_DRAWTEXT_GARAGE_STORE'), 'open_garage2', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
OpenGarage(CurrentHouse)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,57 @@
|
|||
--[[
|
||||
In this section you will find the configuration of the garage that you have selected, in
|
||||
case your system is not found here, you can ask the creator of your garage to add its exports
|
||||
in any of these files, or use these files to create your own, that would help our community!
|
||||
]]
|
||||
|
||||
if Config.Garage ~= 'okokGarage' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage() end
|
||||
|
||||
function StoreVehicle(house)
|
||||
TriggerEvent('okokGarage:StoreVehiclePrivate')
|
||||
end
|
||||
|
||||
function OpenGarage(house)
|
||||
TriggerEvent('okokGarage:OpenPrivateGarageMenu', GetEntityCoords(PlayerPedId()), GetEntityHeading(PlayerPedId()))
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
|
||||
if CurrentHouse ~= nil and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked) and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage then
|
||||
local dist = GetDistanceBetweenCoords(pos, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z, true)
|
||||
|
||||
if dist < 5.0 then
|
||||
DrawMarker(20, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
|
||||
|
||||
if dist < 2.0 then
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
if Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x and Config.Houses[CurrentHouse].garage.y and Config.Houses[CurrentHouse].garage.z then
|
||||
if vehicle and vehicle ~= 0 then
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage1', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not StoreVehicle then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
StoreVehicle(CurrentHouse)
|
||||
end
|
||||
else
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage2', 'E')
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not OpenGarage then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
OpenGarage(CurrentHouse)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,14 @@
|
|||
if Config.Garage ~= 'qb-garages' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage()
|
||||
if not Config.Houses[CurrentHouse] then
|
||||
return
|
||||
end
|
||||
local garage = Config.Houses[CurrentHouse].garage
|
||||
if not garage then
|
||||
return
|
||||
end
|
||||
TriggerEvent('qb-garages:client:setHouseGarage', CurrentHouse, CurrentHouseData.haskey)
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
if Config.Garage ~= 'qs-advancedgarages' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage()
|
||||
print('TriggerHouseUpdateGarage', CurrentHouse, 'haskey', CurrentHouseData.haskey)
|
||||
TriggerEvent('advancedgarages:SetShellGarageData', CurrentHouse, CurrentHouseData.haskey)
|
||||
end
|
|
@ -0,0 +1,57 @@
|
|||
--[[
|
||||
In this section you will find the configuration of the garage that you have selected, in
|
||||
case your system is not found here, you can ask the creator of your garage to add its exports
|
||||
in any of these files, or use these files to create your own, that would help our community!
|
||||
]]
|
||||
|
||||
if Config.Garage ~= 'rcore_garage' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage() end
|
||||
|
||||
function StoreVehicle(house)
|
||||
TriggerEvent('rcore_garage:StoreMyVehicle', 'car')
|
||||
end
|
||||
|
||||
function OpenGarage(house)
|
||||
TriggerEvent('rcore_garage:OpenGarageOnSpot', 'car', 'civ')
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
|
||||
if CurrentHouse ~= nil and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked) and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage then
|
||||
local dist = GetDistanceBetweenCoords(pos, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z, true)
|
||||
|
||||
if dist < 5.0 then
|
||||
DrawMarker(20, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
|
||||
|
||||
if dist < 2.0 then
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
if Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x and Config.Houses[CurrentHouse].garage.y and Config.Houses[CurrentHouse].garage.z then
|
||||
if vehicle and vehicle ~= 0 then
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage1', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not StoreVehicle then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
StoreVehicle(CurrentHouse)
|
||||
end
|
||||
else
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage2', 'E')
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not OpenGarage then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
OpenGarage(CurrentHouse)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,7 @@
|
|||
if Config.Garage ~= 'standalone' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage()
|
||||
return
|
||||
end
|
|
@ -0,0 +1,41 @@
|
|||
if Config.Garage ~= 'vms_garagesv2' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage()
|
||||
return
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(PlayerPedId())
|
||||
if ped and CurrentHouse ~= nil and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked) and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x then
|
||||
local dist = #(pos - vector3(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z))
|
||||
if dist < 5.0 then
|
||||
DrawMarker(20, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
|
||||
if dist < 2.0 then
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
if Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x and Config.Houses[CurrentHouse].garage.y and Config.Houses[CurrentHouse].garage.z then
|
||||
if vehicle and vehicle ~= 0 then
|
||||
DrawText3Ds(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, Lang('HOUSING_DRAWTEXT_GARAGE_STORE'), 'open_garage1', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
exports['vms_garagesv2']:enterHouseGarage()
|
||||
end
|
||||
else
|
||||
DrawText3Ds(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, Lang('HOUSING_DRAWTEXT_GARAGE_STORE'), 'open_garage2', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
exports['vms_garagesv2']:enterHouseGarage()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,57 @@
|
|||
--[[
|
||||
In this section you will find the configuration of the garage that you have selected, in
|
||||
case your system is not found here, you can ask the creator of your garage to add its exports
|
||||
in any of these files, or use these files to create your own, that would help our community!
|
||||
]]
|
||||
|
||||
if Config.Garage ~= 'zerio-garage' then
|
||||
return
|
||||
end
|
||||
|
||||
function TriggerHouseUpdateGarage() end
|
||||
|
||||
function StoreVehicle(house)
|
||||
TriggerEvent('zerio-garage:client:PutBackHouseVehicle', house, 'qs-housing')
|
||||
end
|
||||
|
||||
function OpenGarage(house)
|
||||
TriggerEvent('zerio-garage:client:OpenHousingGarage', house, 'qs-housing')
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
|
||||
if CurrentHouse ~= nil and CurrentHouseData.haskey and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage then
|
||||
local dist = GetDistanceBetweenCoords(pos, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z, true)
|
||||
|
||||
if dist < 5.0 then
|
||||
DrawMarker(20, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
|
||||
|
||||
if dist < 2.0 then
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
if Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x and Config.Houses[CurrentHouse].garage.y and Config.Houses[CurrentHouse].garage.z then
|
||||
if vehicle and vehicle ~= 0 then
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage1', 'E')
|
||||
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not StoreVehicle then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
StoreVehicle(CurrentHouse)
|
||||
end
|
||||
else
|
||||
DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage2', 'E')
|
||||
if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
|
||||
if not OpenGarage then return print('Your client/custom/garages/*.lua is not correctly configured') end
|
||||
OpenGarage(CurrentHouse)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,23 @@
|
|||
if Config.Inventory ~= 'inventory' then
|
||||
return
|
||||
end
|
||||
|
||||
function openStash(customData, uniq)
|
||||
local data = customData or Config.DefaultStashData
|
||||
local house = CurrentHouse
|
||||
local houseData = Config.Houses[house]
|
||||
if not customData then
|
||||
if houseData.ipl then
|
||||
data = houseData.ipl.stash or data
|
||||
else
|
||||
local shellData = Config.Shells[houseData.tier]
|
||||
if shellData then
|
||||
data = shellData.stash or data
|
||||
end
|
||||
end
|
||||
end
|
||||
uniq = uniq or house
|
||||
uniq = uniq:gsub('-', '_')
|
||||
local maxweight = data.maxweight or 10000
|
||||
TriggerEvent('inventory:openInventory', { type = 'stash', id = uniq, title = 'Stash_' .. uniq, weight = maxweight, delay = 100, save = true })
|
||||
end
|
|
@ -0,0 +1,25 @@
|
|||
if Config.Inventory ~= 'codem-inventory' then
|
||||
return
|
||||
end
|
||||
|
||||
function openStash(customData, uniq)
|
||||
local data = customData or Config.DefaultStashData
|
||||
local house = CurrentHouse
|
||||
local houseData = Config.Houses[house]
|
||||
if not customData then
|
||||
if houseData.ipl then
|
||||
data = houseData.ipl.stash or data
|
||||
else
|
||||
local shellData = Config.Shells[houseData.tier]
|
||||
if shellData then
|
||||
data = shellData.stash or data
|
||||
end
|
||||
end
|
||||
end
|
||||
uniq = uniq or house
|
||||
uniq = uniq:gsub('-', '_')
|
||||
local name = uniq
|
||||
local maxweight = data.maxweight or 10000
|
||||
local slot = data.slots or 30
|
||||
exports['codem-inventory']:OpenStash(name, maxweight, slot)
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
if Config.Inventory ~= 'core_inventory' then
|
||||
return
|
||||
end
|
||||
|
||||
function openStash(customData, uniq)
|
||||
local data = customData or Config.DefaultStashData
|
||||
local house = CurrentHouse
|
||||
local houseData = Config.Houses[house]
|
||||
if not customData then
|
||||
if houseData.ipl then
|
||||
data = houseData.ipl.stash or data
|
||||
else
|
||||
local shellData = Config.Shells[houseData.tier]
|
||||
if shellData then
|
||||
data = shellData.stash or data
|
||||
end
|
||||
end
|
||||
end
|
||||
uniq = uniq or house
|
||||
uniq = uniq:gsub('-', '_')
|
||||
TriggerServerEvent('core_inventory:server:openInventory', tostring(uniq):gsub(':', ''):gsub('#', ''):gsub(' ', ''), 'stash', nil, nil)
|
||||
end
|
|
@ -0,0 +1,293 @@
|
|||
if Config.Inventory ~= 'esx_inventory' then
|
||||
return
|
||||
end
|
||||
|
||||
local function BlackMoneyStorage()
|
||||
ESX.UI.Menu.CloseAll()
|
||||
|
||||
ESX.UI.Menu.Open(
|
||||
'default', GetCurrentResourceName(), 'storage',
|
||||
{
|
||||
title = Lang('HOUSING_MENU_STASH_DEFAULT_TITLE'),
|
||||
align = 'right',
|
||||
elements = {
|
||||
{ label = Lang('HOUSING_MENU_STASH_STORE'), value = 's' },
|
||||
{ label = Lang('HOUSING_MENU_STASH_WITHDRAW'), value = 'w' }
|
||||
},
|
||||
},
|
||||
function(data, menu)
|
||||
if data.current.value == 's' then
|
||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'putAmount', { title = Lang('HOUSING_MENU_BLACK_MONEY_AMOUNT') }, function(data3, menu3)
|
||||
local amount = tonumber(data3.value)
|
||||
|
||||
if amount == nil then
|
||||
Notification(Lang('HOUSING_NOTIFICATION_INVALID_AMOUNT'), 'error')
|
||||
else
|
||||
if amount >= 0 then
|
||||
TriggerServerCallback('qb-houses:server:depositBlackMoney', function(success)
|
||||
if success then
|
||||
Notification(Lang('HOUSING_NOTIFICATION_BLACK_MONEY_SUCCESS'), 'success')
|
||||
else
|
||||
Notification(Lang('HOUSING_NOTIFICATION_CANT_AFFORD'), 'error')
|
||||
end
|
||||
end, amount)
|
||||
menu3.close()
|
||||
else
|
||||
Notification(Lang('HOUSING_NOTIFICATION_INVALID_AMOUNT'), 'error')
|
||||
end
|
||||
end
|
||||
end, function(data3, menu3)
|
||||
menu3.close()
|
||||
end)
|
||||
elseif data.current.value == 'w' then
|
||||
TriggerServerCallback('qb-houses:server:getBlackMoney', function(count)
|
||||
local elements = {}
|
||||
|
||||
table.insert(elements, { label = Lang('HOUSING_MENU_BLACK_MONEY_NAME') .. ' $' .. count, value = 'black_money' })
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'withdrawItem', {
|
||||
title = Lang('HOUSING_MENU_BLACK_MONEY_WITHDRAW'),
|
||||
align = 'right',
|
||||
elements = elements
|
||||
}, function(data2, menu2)
|
||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'putAmount', { title = Lang('HOUSING_MENU_BLACK_MONEY_AMOUNT') }, function(data3, menu3)
|
||||
local amount = tonumber(data3.value)
|
||||
|
||||
if amount == nil then
|
||||
Notification(Lang('HOUSING_NOTIFICATION_INVALID_AMOUNT'), 'error')
|
||||
else
|
||||
if amount >= 0 then
|
||||
TriggerServerCallback('qb-houses:server:withdrawBlackMoney', function(success)
|
||||
if success then
|
||||
Notification(Lang('HOUSING_NOTIFICATION_BLACK_MONEY_SUCCESS_WITHDRAW'), 'success')
|
||||
else
|
||||
Notification(Lang('HOUSING_NOTIFICATION_CANT_AFFORD'), 'error')
|
||||
end
|
||||
end, amount)
|
||||
menu3.close()
|
||||
menu2.close()
|
||||
else
|
||||
Notification(Lang('HOUSING_NOTIFICATION_INVALID_AMOUNT'), 'error')
|
||||
end
|
||||
end
|
||||
end, function(data3, menu3)
|
||||
menu3.close()
|
||||
end)
|
||||
end, function(data2, menu2)
|
||||
menu2.close()
|
||||
end)
|
||||
end, id)
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
end
|
||||
|
||||
local function ItemStorage(id)
|
||||
ESX.UI.Menu.CloseAll()
|
||||
|
||||
ESX.UI.Menu.Open(
|
||||
'default', GetCurrentResourceName(), 'storage',
|
||||
{
|
||||
title = Lang('HOUSING_MENU_STASH_DEFAULT_TITLE'),
|
||||
align = 'right',
|
||||
elements = {
|
||||
{ label = Lang('HOUSING_MENU_STASH_STORE'), value = 's' },
|
||||
{ label = Lang('HOUSING_MENU_STASH_WITHDRAW'), value = 'w' }
|
||||
},
|
||||
},
|
||||
function(data, menu)
|
||||
if data.current.value == 's' then
|
||||
TriggerServerCallback('qb-houses:server:getInventory', function(inv)
|
||||
local elements = {}
|
||||
|
||||
for k, v in pairs(inv['items']) do
|
||||
if v['count'] >= 1 then
|
||||
table.insert(elements, { label = ('x%s %s'):format(v['count'], v['label']), type = 'item', value = v['name'] })
|
||||
end
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'storeItem', {
|
||||
title = Lang('HOUSING_MENU_PLAYER_INVENTORY'),
|
||||
align = 'right',
|
||||
elements = elements
|
||||
}, function(data2, menu2)
|
||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'putAmount', { title = 'Amount' }, function(data3, menu3)
|
||||
local amount = tonumber(data3.value)
|
||||
|
||||
if amount == nil then
|
||||
Notification(Lang('HOUSING_NOTIFICATION_INVALID_AMOUNT'), 'error')
|
||||
else
|
||||
if amount >= 0 then
|
||||
TriggerServerEvent('qb-houses:server:storeItem', data2.current.type, data2.current.value, tonumber(data3.value), id)
|
||||
menu3.close()
|
||||
menu2.close()
|
||||
else
|
||||
Notification(Lang('HOUSING_NOTIFICATION_INVALID_AMOUNT'), 'error')
|
||||
end
|
||||
end
|
||||
end, function(data3, menu3)
|
||||
menu3.close()
|
||||
end)
|
||||
end, function(data2, menu2)
|
||||
menu2.close()
|
||||
end)
|
||||
end)
|
||||
elseif data.current.value == 'w' then
|
||||
TriggerServerCallback('qb-houses:server:getHouseInventory', function(inv)
|
||||
local elements = {}
|
||||
|
||||
for k, v in pairs(inv['items']) do
|
||||
if v['count'] > 0 then
|
||||
table.insert(elements, { label = ('x%s %s'):format(v['count'], v['label']), value = v['name'] })
|
||||
end
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'withdrawItem', {
|
||||
title = Lang('HOUSING_MENU_HOUSE_INVENTORY'),
|
||||
align = 'right',
|
||||
elements = elements
|
||||
}, function(data2, menu2)
|
||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'putAmount', { title = 'Amount' }, function(data3, menu3)
|
||||
local amount = tonumber(data3.value)
|
||||
|
||||
if amount == nil then
|
||||
Notification(Lang('HOUSING_NOTIFICATION_INVALID_AMOUNT'), 'error')
|
||||
else
|
||||
if amount >= 0 then
|
||||
TriggerServerEvent('qb-houses:server:withdrawItem', 'item', data2.current.value, tonumber(data3.value), id)
|
||||
menu3.close()
|
||||
menu2.close()
|
||||
else
|
||||
Notification(Lang('HOUSING_NOTIFICATION_INVALID_AMOUNT'), 'error')
|
||||
end
|
||||
end
|
||||
end, function(data3, menu3)
|
||||
menu3.close()
|
||||
end)
|
||||
end, function(data2, menu2)
|
||||
menu2.close()
|
||||
end)
|
||||
end, id)
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
end
|
||||
|
||||
local function WeaponStorage(id)
|
||||
ESX.UI.Menu.CloseAll()
|
||||
TriggerServerCallback('qb-houses:server:getInventory', function(inv)
|
||||
local elements = {}
|
||||
|
||||
for k, v in pairs(inv['weapons']) do
|
||||
table.insert(elements, { label = v['label'], weapon = v['name'], ammo = v['ammo'] })
|
||||
end
|
||||
end)
|
||||
|
||||
ESX.UI.Menu.Open(
|
||||
'default', GetCurrentResourceName(), 'storage',
|
||||
{
|
||||
title = Lang('HOUSING_MENU_STASH_DEFAULT_TITLE'),
|
||||
align = 'right',
|
||||
elements = {
|
||||
{ label = Lang('HOUSING_MENU_STASH_STORE'), value = 's' },
|
||||
{ label = Lang('HOUSING_MENU_STASH_WITHDRAW'), value = 'w' }
|
||||
},
|
||||
},
|
||||
function(data, menu)
|
||||
if data.current.value == 's' then
|
||||
TriggerServerCallback('qb-houses:server:getInventory', function(inv)
|
||||
local elements = {}
|
||||
|
||||
for k, v in pairs(inv['weapons']) do
|
||||
table.insert(elements, { label = v['label'], weapon = v['name'], ammo = v['ammo'] })
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'storeItem', {
|
||||
title = Lang('HOUSING_MENU_HOUSE_INVENTORY'),
|
||||
align = 'right',
|
||||
elements = elements
|
||||
}, function(data2, menu2)
|
||||
TriggerServerEvent('qb-houses:server:storeItem', 'weapon', data2.current.weapon, data2.current.ammo, id)
|
||||
menu2.close()
|
||||
end, function(data2, menu2)
|
||||
menu2.close()
|
||||
end)
|
||||
end)
|
||||
elseif data.current.value == 'w' then
|
||||
TriggerServerCallback('qb-houses:server:getHouseInventory', function(inv)
|
||||
local elements = {}
|
||||
|
||||
for k, v in pairs(inv['weapons']) do
|
||||
table.insert(elements, { label = ('%s | x%s %s'):format(ESX.GetWeaponLabel(v['name']), v['ammo'], 'bullets'), weapon = v['name'], ammo = v['ammo'] })
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'withdrawItem', {
|
||||
title = Lang('HOUSING_MENU_HOUSE_INVENTORY'),
|
||||
align = 'right',
|
||||
elements = elements
|
||||
}, function(data2, menu2)
|
||||
TriggerServerEvent('qb-houses:server:withdrawItem', 'weapon', data2.current.weapon, data2.current.ammo, id)
|
||||
menu2.close()
|
||||
end, function(data2, menu2)
|
||||
menu2.close()
|
||||
end)
|
||||
end, id)
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
end
|
||||
|
||||
local function DefaultQbcoreStash(customData, uniq)
|
||||
local data = customData or Config.DefaultStashData
|
||||
local house = CurrentHouse
|
||||
local houseData = Config.Houses[house]
|
||||
if not customData then
|
||||
if houseData.ipl then
|
||||
data = houseData.ipl.stash or data
|
||||
else
|
||||
local shellData = Config.Shells[houseData.tier]
|
||||
if shellData then
|
||||
data = shellData.stash or data
|
||||
end
|
||||
end
|
||||
end
|
||||
uniq = uniq or house
|
||||
TriggerServerEvent('inventory:server:OpenInventory', 'stash', uniq, data)
|
||||
TriggerEvent('inventory:client:SetCurrentStash', uniq)
|
||||
end
|
||||
|
||||
function openStash(customData, uniq)
|
||||
if Config.Framework == 'qb' then
|
||||
return DefaultQbcoreStash(customData, uniq)
|
||||
end
|
||||
|
||||
ESX.UI.Menu.CloseAll()
|
||||
|
||||
ESX.UI.Menu.Open(
|
||||
'default', GetCurrentResourceName(), 'storage',
|
||||
{
|
||||
title = Lang('HOUSING_MENU_STASH_DEFAULT_TITLE'),
|
||||
align = 'right',
|
||||
elements = {
|
||||
|
||||
{ label = Lang('HOUSING_MENU_STASH_ITEMS'), value = 'i' },
|
||||
{ label = Lang('HOUSING_MENU_STASH_WEAPONS'), value = 'w' },
|
||||
{ label = Lang('HOUSING_MENU_BLACK_MONEY_NAME'), value = 'b' }
|
||||
},
|
||||
},
|
||||
function(data, menu)
|
||||
if data.current.value == 'i' then
|
||||
ItemStorage()
|
||||
elseif data.current.value == 'w' then
|
||||
WeaponStorage()
|
||||
elseif data.current.value == 'b' then
|
||||
BlackMoneyStorage()
|
||||
end
|
||||
end,
|
||||
function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
if Config.Inventory ~= 'origen_inventory' then
|
||||
return
|
||||
end
|
||||
|
||||
function openStash(customData, uniq)
|
||||
local data = customData or Config.DefaultStashData
|
||||
local house = CurrentHouse
|
||||
local houseData = Config.Houses[house]
|
||||
if not customData then
|
||||
if houseData.ipl then
|
||||
data = houseData.ipl.stash or data
|
||||
else
|
||||
local shellData = Config.Shells[houseData.tier]
|
||||
if shellData then
|
||||
data = shellData.stash or data
|
||||
end
|
||||
end
|
||||
end
|
||||
uniq = uniq or house
|
||||
uniq = uniq:gsub('-', '_')
|
||||
TriggerServerEvent('inventory:server:OpenInventory', 'stash', 'stash_house' .. uniq .. '', data)
|
||||
end
|
|
@ -0,0 +1,39 @@
|
|||
if Config.Inventory ~= 'ox_inventory' then
|
||||
return
|
||||
end
|
||||
|
||||
local ox_inventory = exports.ox_inventory
|
||||
|
||||
function openStash(customData, uniq)
|
||||
local data = customData or Config.DefaultStashData
|
||||
local house = CurrentHouse
|
||||
local houseData = Config.Houses[house]
|
||||
if not customData then
|
||||
if houseData.ipl then
|
||||
data = houseData.ipl.stash or data
|
||||
else
|
||||
local shellData = Config.Shells[houseData.tier]
|
||||
if shellData then
|
||||
data = shellData.stash or data
|
||||
end
|
||||
end
|
||||
end
|
||||
uniq = uniq or house
|
||||
uniq = uniq:gsub('-', '_')
|
||||
local maxweight = data.maxweight or 10000
|
||||
local slot = data.slots or 30
|
||||
if ox_inventory:openInventory('stash', uniq) == false then
|
||||
TriggerServerEvent('qb-houses:server:RegisterStash', uniq, slot, maxweight)
|
||||
ox_inventory:openInventory('stash', uniq)
|
||||
Debug('Ox Stash', 'Registering new stash', uniq)
|
||||
end
|
||||
end
|
||||
|
||||
exports('lockpick', function()
|
||||
local jobCount = TriggerServerCallbackSync('housing:checkTotalJobCount')
|
||||
if jobCount < Config.RequiredCop then
|
||||
TriggerEvent('qb-houses:sendTextMessage', Lang('HOUSING_NOTIFICATION_NO_POLICES'), 'error')
|
||||
return
|
||||
end
|
||||
TriggerEvent('qb-houses:client:lockpick')
|
||||
end)
|
|
@ -0,0 +1,31 @@
|
|||
if Config.Inventory ~= 'ps-inventory' then
|
||||
return
|
||||
end
|
||||
|
||||
function openStash(customData, uniq)
|
||||
local data = customData or Config.DefaultStashData
|
||||
local house = CurrentHouse
|
||||
local houseData = Config.Houses[house]
|
||||
|
||||
if not customData then
|
||||
if houseData.ipl then
|
||||
data = houseData.ipl.stash or data
|
||||
else
|
||||
local shellData = Config.Shells[houseData.tier]
|
||||
if shellData then
|
||||
data = shellData.stash or data
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
uniq = uniq or house
|
||||
uniq = uniq:gsub('-', '_')
|
||||
|
||||
TriggerServerEvent('ps-inventory:server:OpenInventory', 'stash', uniq, data)
|
||||
|
||||
TriggerEvent('ps-inventory:client:SetCurrentStash', uniq)
|
||||
end
|
||||
|
||||
RegisterNetEvent('ps-inventory:client:SetCurrentStash', function(stash)
|
||||
CurrentStash = stash
|
||||
end)
|
|
@ -0,0 +1,25 @@
|
|||
if Config.Inventory ~= 'qb-inventory' then
|
||||
return
|
||||
end
|
||||
|
||||
function openStash(customData, uniq)
|
||||
local data = customData or Config.DefaultStashData
|
||||
local house = CurrentHouse
|
||||
local houseData = Config.Houses[house]
|
||||
if not customData then
|
||||
if houseData.ipl then
|
||||
data = houseData.ipl.stash or data
|
||||
else
|
||||
local shellData = Config.Shells[houseData.tier]
|
||||
if shellData then
|
||||
data = shellData.stash or data
|
||||
end
|
||||
end
|
||||
end
|
||||
uniq = uniq or house
|
||||
uniq = uniq:gsub('-', '_')
|
||||
-- if you use old qb-inventory version, uncomment here and remove 'housing:openStash' trigger.
|
||||
-- TriggerServerEvent('inventory:server:OpenInventory', 'stash', uniq, data)
|
||||
-- TriggerEvent('inventory:client:SetCurrentStash', uniq)
|
||||
TriggerServerEvent('housing:openStash', uniq, data)
|
||||
end
|
|
@ -0,0 +1,23 @@
|
|||
if Config.Inventory ~= 'qs-inventory' then
|
||||
return
|
||||
end
|
||||
|
||||
function openStash(customData, uniq)
|
||||
local data = customData or Config.DefaultStashData
|
||||
local house = CurrentHouse
|
||||
local houseData = Config.Houses[house]
|
||||
if not customData then
|
||||
if houseData.ipl then
|
||||
data = houseData.ipl.stash or data
|
||||
else
|
||||
local shellData = Config.Shells[houseData.tier]
|
||||
if shellData then
|
||||
data = shellData.stash or data
|
||||
end
|
||||
end
|
||||
end
|
||||
uniq = uniq or house
|
||||
uniq = uniq:gsub('-', '_')
|
||||
TriggerServerEvent('inventory:server:OpenInventory', 'stash', uniq, data)
|
||||
TriggerEvent('inventory:client:SetCurrentStash', uniq)
|
||||
end
|
|
@ -0,0 +1,26 @@
|
|||
if Config.Inventory ~= 'tgiann-inventory' then
|
||||
return
|
||||
end
|
||||
|
||||
function openStash(customData, uniq)
|
||||
local data = customData or Config.DefaultStashData
|
||||
local house = CurrentHouse
|
||||
local houseData = Config.Houses[house]
|
||||
if not customData then
|
||||
if houseData.ipl then
|
||||
data = houseData.ipl.stash or data
|
||||
else
|
||||
local shellData = Config.Shells[houseData.tier]
|
||||
if shellData then
|
||||
data = shellData.stash or data
|
||||
end
|
||||
end
|
||||
end
|
||||
uniq = uniq or house
|
||||
uniq = uniq:gsub('-', '_')
|
||||
local maxweight = data.maxweight or 10000
|
||||
exports['tgiann-inventory']:OpenInventory('stash', uniq, {
|
||||
maxweight = maxweight,
|
||||
slots = data.slots or 100,
|
||||
})
|
||||
end
|
148
resources/[housing]/qs-housing/client/custom/menu/ox_lib.lua
Normal file
148
resources/[housing]/qs-housing/client/custom/menu/ox_lib.lua
Normal file
|
@ -0,0 +1,148 @@
|
|||
---@param _type? 'lockpick' | 'police'
|
||||
function OpenApartmentMenu(_type)
|
||||
local apartmentDatas = TriggerServerCallbackSync('housing:getApartmentsData', CurrentHouse)
|
||||
if not apartmentDatas or not next(apartmentDatas) then return Notification(Lang('HOUSING_NOTIFICATION_NO_APARTMENTS'), 'error') end
|
||||
local data = {}
|
||||
for k, v in pairs(apartmentDatas) do
|
||||
local description = Lang('HOUSING_MENU_APARTMENT_SALES')
|
||||
local houseData = Config.Houses[v.house]
|
||||
if v.ownedByMe and v.haskey then
|
||||
description = Lang('HOUSING_MENU_APARTMENT_OWN')
|
||||
elseif v.haskey then
|
||||
description = Lang('HOUSING_MENU_APARTMENT_NO_KEY')
|
||||
elseif v.purchasable then
|
||||
description = Lang('HOUSING_MENU_APARTMENT_SALES')
|
||||
elseif v.rentable then
|
||||
description = Lang('HOUSING_MENU_APARTMENT_RENT')
|
||||
elseif not houseData.locked then
|
||||
description = Lang('HOUSING_MENU_APARTMENT_NOT_LOCKED')
|
||||
elseif v.isOwned then
|
||||
description = Lang('HOUSING_MENU_APARTMENT_OWNED')
|
||||
end
|
||||
table.insert(data, {
|
||||
title = v.ownedByMe and Lang('HOUSING_MENU_APARTMENT_SELECT_YOUR') .. k or Lang('HOUSING_MENU_APARTMENT_SELECT') .. k,
|
||||
description = description,
|
||||
onSelect = function(args)
|
||||
if _type == 'lockpick' then
|
||||
LockPick(v.house)
|
||||
return
|
||||
elseif _type == 'police' then
|
||||
RamDoor(v.house)
|
||||
return
|
||||
end
|
||||
if not v.isOwned or v.rentable or v.purchasable then
|
||||
OpenApartmentBuyMenu(v)
|
||||
return
|
||||
elseif v.haskey or not houseData.locked then
|
||||
CurrentHouseData = v
|
||||
CurrentHouse = v.house
|
||||
TriggerEvent('qb-houses:client:EnterHouse', houseData.ipl, v.house, v)
|
||||
return
|
||||
end
|
||||
Notification(Lang('HOUSING_NOTIFICATION_YOU_RING_DOOR'), 'inform')
|
||||
TriggerServerEvent('qb-houses:server:RingDoor', v.house)
|
||||
end,
|
||||
disabled = (_type == 'lockpick' or _type == 'police') and (not v.isOwned or not houseData.locked)
|
||||
})
|
||||
end
|
||||
lib.registerContext({
|
||||
id = 'apartment_menu',
|
||||
title = Lang('HOUSING_MENU_APARTMENT_TITLE'),
|
||||
options = data
|
||||
})
|
||||
lib.showContext('apartment_menu')
|
||||
end
|
||||
|
||||
function OpenApartmentBuyMenu(apartment)
|
||||
local data = {}
|
||||
if apartment.rentable then
|
||||
table.insert(data, {
|
||||
title = Lang('HOUSING_MENU_APARTMENT_RENT_TITLE'),
|
||||
-- description = 'Rent',
|
||||
onSelect = function(args)
|
||||
CurrentApartment = apartment
|
||||
TriggerServerEvent('qb-houses:server:viewHouse', apartment.house, true)
|
||||
end
|
||||
})
|
||||
else
|
||||
table.insert(data, {
|
||||
title = Lang('HOUSING_MENU_APARTMENT_BUY_TITLE'),
|
||||
-- description = 'Buy',
|
||||
onSelect = function(args)
|
||||
CurrentApartment = apartment
|
||||
TriggerServerEvent('qb-houses:server:viewHouse', apartment.house)
|
||||
end
|
||||
})
|
||||
end
|
||||
local houseData = Config.Houses[apartment.house]
|
||||
table.insert(data, {
|
||||
title = Lang('HOUSING_MENU_APARTMENT_INSPECT_TITLE'),
|
||||
-- description = 'Inspect',
|
||||
onSelect = function(args)
|
||||
InspectHouse(houseData, apartment.house)
|
||||
end
|
||||
})
|
||||
lib.registerContext({
|
||||
id = 'apartment_buy_interactions',
|
||||
title = Lang('HOUSING_MENU_APARTMENT_INTERACTIONS'),
|
||||
options = data
|
||||
})
|
||||
lib.showContext('apartment_buy_interactions')
|
||||
end
|
||||
|
||||
function OpenMyApartments()
|
||||
local apartmentDatas = TriggerServerCallbackSync('housing:getApartmentsData', CurrentHouse)
|
||||
if not apartmentDatas or not next(apartmentDatas) then return Notification(Lang('HOUSING_NOTIFICATION_NO_APARTMENTS'), 'error') end
|
||||
local data = {}
|
||||
for k, v in pairs(apartmentDatas) do
|
||||
if not v.ownedByMe then goto continue end
|
||||
local houseData = Config.Houses[v.house]
|
||||
table.insert(data, {
|
||||
title = Lang('HOUSING_MENU_APARTMENT_SELECT_YOUR') .. k,
|
||||
--- description = 'Your Apartment',
|
||||
onSelect = function(args)
|
||||
v.currentHouse = CurrentHouse
|
||||
v.currentHouseData = CurrentHouseData
|
||||
CurrentApartment = v
|
||||
CurrentHouse = v.house
|
||||
CurrentHouseData = v
|
||||
houseData.name = Lang('HOUSING_MENU_APARTMENT_SELECT_YOUR') .. k
|
||||
GetDecorations(CurrentHouse)
|
||||
OpenManagement(houseData)
|
||||
end,
|
||||
})
|
||||
::continue::
|
||||
end
|
||||
if #data == 0 then return Notification(Lang('HOUSING_NOTIFICATION_NO_OWNED_APARTMENTS'), 'error') end
|
||||
lib.registerContext({
|
||||
id = 'my_apartment_menu',
|
||||
title = Lang('HOUSING_MENU_MY_APARTMENT'),
|
||||
options = data
|
||||
})
|
||||
lib.showContext('my_apartment_menu')
|
||||
end
|
||||
|
||||
function OpenHireApartments()
|
||||
local apartmentDatas = TriggerServerCallbackSync('housing:getApartmentsData', CurrentHouse, true)
|
||||
if not apartmentDatas or not next(apartmentDatas) then return Notification(Lang('HOUSING_NOTIFICATION_NO_APARTMENTS'), 'error') end
|
||||
apartmentDatas = table.filter(apartmentDatas, function(v)
|
||||
return v.rented
|
||||
end)
|
||||
if #apartmentDatas == 0 then return Notification(Lang('HOUSING_NOTIFICATION_NO_RENTED_APARTMENTS'), 'error') end
|
||||
local data = {}
|
||||
for k, v in pairs(apartmentDatas) do
|
||||
table.insert(data, {
|
||||
title = Lang('HOUSING_MENU_HIRE_APARTMENT_NUMBER') .. ' ' .. k,
|
||||
onSelect = function(args)
|
||||
TriggerServerEvent('housing:hireRenter', v.house)
|
||||
end,
|
||||
})
|
||||
end
|
||||
if #data == 0 then return Notification(Lang('HOUSING_NOTIFICATION_NO_RENTED_APARTMENTS'), 'error') end
|
||||
lib.registerContext({
|
||||
id = 'hire_apartment_menu',
|
||||
title = Lang('HOUSING_MENU_HIRE_APARTMENT'),
|
||||
options = data
|
||||
})
|
||||
lib.showContext('hire_apartment_menu')
|
||||
end
|
|
@ -0,0 +1,461 @@
|
|||
if not Config.UseTarget then
|
||||
return
|
||||
end
|
||||
|
||||
local target_name = GetResourceState('ox_target'):find('started') and 'qtarget' or 'qb-target'
|
||||
|
||||
---@class Target
|
||||
---@field houses table
|
||||
Target = {
|
||||
zones = {},
|
||||
}
|
||||
|
||||
local function checkKey()
|
||||
if CurrentHouse ~= nil and CurrentHouseData.haskey then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local lastMLODoors = {}
|
||||
|
||||
function Target:initMLODoors(key)
|
||||
local houseData = self.houses[key]
|
||||
if not houseData then return end
|
||||
if not houseData.mlo then return end
|
||||
local hashes = {}
|
||||
for doorId, data in pairs(houseData.mlo) do
|
||||
local has = table.find(hashes, function(v)
|
||||
return v == data.hash
|
||||
end)
|
||||
if not has then
|
||||
table.insert(hashes, data.hash)
|
||||
end
|
||||
end
|
||||
lastMLODoors = hashes
|
||||
local confirmed = {}
|
||||
exports[target_name]:AddTargetModel(hashes, {
|
||||
options = {
|
||||
{
|
||||
icon = 'fa-solid fa-door-open',
|
||||
label = Lang('HOUSING_TARGET_TOGGLE_DOOR'),
|
||||
action = function(entity)
|
||||
local coords = GetEntityCoords(entity)
|
||||
local finded, doorId = table.find(houseData.mlo, function(door)
|
||||
local doorCoords = vec3(door.coords.x, door.coords.y, door.coords.z)
|
||||
local distance = #(coords - doorCoords)
|
||||
return distance < Config.DoorDistance
|
||||
end)
|
||||
if not finded then return end
|
||||
local doorData = houseData.mlo[doorId]
|
||||
if not checkKey() then return Notification(Lang('HOUSING_NOTIFICATION_NO_KEYS'), 'error') end
|
||||
RequestAnimDict('anim@heists@keycard@')
|
||||
while not HasAnimDictLoaded('anim@heists@keycard@') do
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
TaskPlayAnim(PlayerPedId(), 'anim@heists@keycard@', 'exit', 8.0, 8.0, 1000, 1, 1, 0, 0, 0)
|
||||
TriggerServerEvent('qb-houses:SyncDoor', CurrentHouse, { finded }, not doorData.locked)
|
||||
end,
|
||||
canInteract = function(entity)
|
||||
if not CurrentHouse then
|
||||
return false
|
||||
end
|
||||
if confirmed[entity] then
|
||||
return true
|
||||
end
|
||||
local coords = GetEntityCoords(entity)
|
||||
local finded = table.find(houseData.mlo, function(door)
|
||||
local doorCoords = vec3(door.coords.x, door.coords.y, door.coords.z)
|
||||
local distance = #(coords - doorCoords)
|
||||
return distance < Config.DoorDistance
|
||||
end)
|
||||
if not finded then
|
||||
return false
|
||||
end
|
||||
confirmed[entity] = finded
|
||||
return true
|
||||
end
|
||||
},
|
||||
},
|
||||
distance = 2.5
|
||||
})
|
||||
end
|
||||
|
||||
function Target:initObjectInteractions()
|
||||
local hashes = {}
|
||||
for a, x in pairs(Config.DynamicFurnitures) do
|
||||
table.insert(hashes, GetHashKey(a))
|
||||
end
|
||||
|
||||
exports[target_name]:AddTargetModel(hashes, {
|
||||
options = {
|
||||
{
|
||||
icon = 'fa-solid fa-magnifying-glass',
|
||||
label = Lang('HOUSING_TARGET_FURNITURE_INTERACTION'),
|
||||
action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL
|
||||
local decorations = ObjectList
|
||||
if not decorations then return end
|
||||
local decorationData = table.find(decorations, function(decoration)
|
||||
return GetHashKey(decoration.modelName) == GetEntityModel(entity) and decoration.handle == entity
|
||||
end)
|
||||
local objectData = table.find(Config.DynamicFurnitures, function(furniData, key)
|
||||
return GetHashKey(key) == GetEntityModel(entity)
|
||||
end)
|
||||
if not objectData then return print('No objectData') end
|
||||
if not decorationData then return print('No decorationData') end
|
||||
if objectData.event then
|
||||
local uniq = decorationData.uniq
|
||||
TriggerEvent(objectData.event, uniq)
|
||||
return
|
||||
end
|
||||
if objectData.type == 'stash' then
|
||||
local uniq = decorationData.uniq
|
||||
if CanAccessStash(uniq) then
|
||||
openStash(objectData.stash, uniq)
|
||||
end
|
||||
elseif objectData.type == 'gardrobe' then
|
||||
openWardrobe()
|
||||
end
|
||||
end,
|
||||
canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL
|
||||
local house = CurrentHouse
|
||||
if not house then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
},
|
||||
{
|
||||
icon = 'fa-solid fa-magnifying-glass',
|
||||
label = Lang('HOUSING_MENU_VAULT_SET_CODE'),
|
||||
action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL
|
||||
local house = CurrentHouse
|
||||
local decorations = ObjectList
|
||||
if not decorations then
|
||||
Notification(Lang('HOUSING_NOTIFICATION_VAULT_CANNOT_DECORATRIONS'), 'error')
|
||||
return
|
||||
end
|
||||
local decorationData = table.find(decorations, function(decoration)
|
||||
return GetHashKey(decoration.modelName) == GetEntityModel(entity)
|
||||
end)
|
||||
local objectData = table.find(Config.DynamicFurnitures, function(furniData, key)
|
||||
return GetHashKey(key) == GetEntityModel(entity)
|
||||
end)
|
||||
if not objectData then
|
||||
Notification(Lang('HOUSING_NOTIFICATION_VAULT_CANNOT_OBJECT_DATA'), 'error')
|
||||
return
|
||||
end
|
||||
if not decorationData then
|
||||
Notification(Lang('HOUSING_NOTIFICATION_VAULT_CANOT_DECORATION_DATA'), 'error')
|
||||
return
|
||||
end
|
||||
if objectData.type == 'stash' then
|
||||
local uniq = decorationData.uniq
|
||||
OpenVaultCodeMenu(uniq)
|
||||
return
|
||||
end
|
||||
Notification(Lang('HOUSING_NOTIFICATION_VAULT_CANNOT_SET_CODE'), 'error')
|
||||
end,
|
||||
canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL
|
||||
if not CurrentHouseData.isOfficialOwner then return false end
|
||||
local houseData = Config.Houses[CurrentHouse]
|
||||
return table.includes(houseData.upgrades, 'vault')
|
||||
end,
|
||||
}
|
||||
},
|
||||
distance = Config.TargetLength,
|
||||
})
|
||||
Target.initObjectInteractions = nil
|
||||
end
|
||||
|
||||
local function checkHouseHasOwner()
|
||||
if not CurrentHouseData.isOwned or CurrentHouseData.rentable or CurrentHouseData.purchasable then return false end
|
||||
return true
|
||||
end
|
||||
|
||||
function Target:initOutside(key)
|
||||
local houseData = self.houses[key]
|
||||
local enterCoords = vec3(houseData.coords.enter.x, houseData.coords.enter.y, houseData.coords.enter.z)
|
||||
local options = {}
|
||||
if houseData.apartmentNumber then
|
||||
table.insert(options, {
|
||||
icon = 'fa-solid fa-magnifying-glass',
|
||||
label = Lang('HOUSING_TARGET_SHOW_APARTMENTS'),
|
||||
action = function()
|
||||
OpenApartmentMenu()
|
||||
end,
|
||||
canInteract = function(entity, distance, data)
|
||||
if checkHouseHasOwner() then return false end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
elseif not houseData.apartmentNumber then
|
||||
options = {
|
||||
{
|
||||
icon = 'fa-solid fa-magnifying-glass',
|
||||
label = Lang('HOUSING_TARGET_SHOW_HOUSE'),
|
||||
action = function()
|
||||
InspectHouse(houseData)
|
||||
end,
|
||||
canInteract = function(entity, distance, data)
|
||||
if checkHouseHasOwner() then return false end
|
||||
return true
|
||||
end,
|
||||
},
|
||||
{
|
||||
icon = 'fas fa-file-contract',
|
||||
label = Lang('HOUSING_TARGET_VIEW_HOUSE'),
|
||||
action = function()
|
||||
if CurrentHouseData.rentable then
|
||||
TriggerServerEvent('qb-houses:server:viewHouse', CurrentHouse, true)
|
||||
else
|
||||
TriggerServerEvent('qb-houses:server:viewHouse', CurrentHouse)
|
||||
end
|
||||
end,
|
||||
canInteract = function(entity, distance, data)
|
||||
if checkHouseHasOwner() then return false end
|
||||
return true
|
||||
end,
|
||||
},
|
||||
{
|
||||
icon = 'fa-solid fa-door-open',
|
||||
label = Lang('HOUSING_TARGET_ENTER_HOUSE'),
|
||||
action = function()
|
||||
TriggerEvent('qb-houses:client:EnterHouse', houseData.ipl)
|
||||
end,
|
||||
canInteract = function(entity, distance, data)
|
||||
if not CurrentHouse then return false end
|
||||
if Config.Houses[CurrentHouse].mlo then return false end
|
||||
if not checkHouseHasOwner() then return false end
|
||||
if not CurrentHouseData.haskey and not Config.Houses[CurrentHouse].IsRammed then return false end
|
||||
return true
|
||||
end,
|
||||
},
|
||||
{
|
||||
icon = 'fa-solid fa-bell',
|
||||
label = Lang('HOUSING_TARGET_REQUEST_RING'),
|
||||
action = function()
|
||||
TriggerEvent('qb-houses:client:RequestRing')
|
||||
end,
|
||||
canInteract = function(entity, distance, data)
|
||||
if not CurrentHouse then return false end
|
||||
if Config.Houses[CurrentHouse].mlo then return false end
|
||||
if not checkHouseHasOwner() then return false end
|
||||
if CurrentHouseData.haskey or Config.Houses[CurrentHouse].IsRammed then return false end
|
||||
return true
|
||||
end,
|
||||
},
|
||||
}
|
||||
end
|
||||
if #options == 0 then return end
|
||||
exports[target_name]:AddBoxZone('house_outside' .. key, enterCoords, Config.TargetLength, Config.TargetWidth, {
|
||||
name = 'house_outside' .. key,
|
||||
heading = 90.0,
|
||||
debugPoly = Config.ZoneDebug,
|
||||
minZ = enterCoords.z - 15.0,
|
||||
maxZ = enterCoords.z + 5.0,
|
||||
}, {
|
||||
options = options,
|
||||
distance = 2.5
|
||||
})
|
||||
table.insert(self.zones, 'house_outside' .. key)
|
||||
end
|
||||
|
||||
function Target:initExit(key)
|
||||
local houseData = self.houses[key]
|
||||
local exitCoords
|
||||
if houseData.mlo then return end
|
||||
if houseData.ipl then
|
||||
exitCoords = vec3(houseData.ipl.exit.x, houseData.ipl.exit.y, houseData.ipl.exit.z)
|
||||
else
|
||||
if not houseData.coords.exit then return end
|
||||
exitCoords = vec3(houseData.coords.exit.x, houseData.coords.exit.y, houseData.coords.exit.z)
|
||||
end
|
||||
exports[target_name]:AddBoxZone('house_exit' .. key, exitCoords, Config.TargetLength, Config.TargetWidth, {
|
||||
name = 'house_exit' .. key,
|
||||
heading = 90.0,
|
||||
debugPoly = Config.ZoneDebug,
|
||||
minZ = exitCoords.z - 15.0,
|
||||
maxZ = exitCoords.z + 5.0,
|
||||
}, {
|
||||
options = {
|
||||
{
|
||||
icon = 'fa-solid fa-door-open',
|
||||
label = Lang('HOUSING_TARGET_EXIT_HOUSE'),
|
||||
action = function()
|
||||
if houseData.ipl then
|
||||
LeaveIplHouse(EnteredHouse, inOwned)
|
||||
else
|
||||
LeaveHouse()
|
||||
end
|
||||
end,
|
||||
canInteract = function(entity, distance, data)
|
||||
return true
|
||||
end,
|
||||
},
|
||||
{
|
||||
icon = 'fa-solid fa-bell',
|
||||
label = Lang('HOUSING_TARGET_RING_DOORBELL'),
|
||||
action = function()
|
||||
TriggerServerEvent('qb-houses:server:OpenDoor', CurrentDoorBell, CurrentHouse)
|
||||
CurrentDoorBell = 0
|
||||
end,
|
||||
canInteract = function(entity, distance, data)
|
||||
return CurrentDoorBell ~= 0
|
||||
end,
|
||||
},
|
||||
{
|
||||
icon = 'fa-solid fa-video',
|
||||
label = Lang('HOUSING_TARGET_ACCESS_CAMERA'),
|
||||
action = function()
|
||||
FrontDoorCam(houseData.coords.enter)
|
||||
end,
|
||||
canInteract = function(entity, distance, data)
|
||||
if houseData.ipl then return false end
|
||||
return not inOwned
|
||||
end,
|
||||
},
|
||||
},
|
||||
distance = 2.5
|
||||
})
|
||||
table.insert(self.zones, 'house_exit' .. key)
|
||||
end
|
||||
|
||||
function Target:initWardrobe()
|
||||
local wardrobe = CurrentHouseData.wardrobe
|
||||
if not wardrobe then return Debug('Target:initWardrobe ::: No wardrobe coords') end
|
||||
exports[target_name]:AddBoxZone('house_wardrobe', wardrobe, Config.TargetLength, Config.TargetWidth, {
|
||||
name = 'house_wardrobe',
|
||||
heading = 90.0,
|
||||
debugPoly = Config.ZoneDebug,
|
||||
minZ = wardrobe.z - 15.0,
|
||||
maxZ = wardrobe.z + 5.0,
|
||||
}, {
|
||||
options = {
|
||||
{
|
||||
icon = 'fa-solid fa-magnifying-glass',
|
||||
label = Lang('HOUSING_TARGET_WARDROBE_INTERACTION'),
|
||||
action = function()
|
||||
openWardrobe()
|
||||
end,
|
||||
canInteract = function(entity, distance, data)
|
||||
return true
|
||||
end,
|
||||
},
|
||||
},
|
||||
distance = 2.5
|
||||
})
|
||||
end
|
||||
|
||||
function Target:initStash()
|
||||
local stash = CurrentHouseData.stash
|
||||
if not stash then return Debug('Target:initStash ::: No stash coords') end
|
||||
exports[target_name]:AddBoxZone('house_stash', stash, Config.TargetLength, Config.TargetWidth, {
|
||||
name = 'house_stash',
|
||||
heading = 90.0,
|
||||
debugPoly = Config.ZoneDebug,
|
||||
minZ = stash.z - 15.0,
|
||||
maxZ = stash.z + 5.0,
|
||||
}, {
|
||||
options = {
|
||||
{
|
||||
icon = 'fa-solid fa-magnifying-glass',
|
||||
label = Lang('HOUSING_TARGET_STASH_INTERACTION'),
|
||||
action = function()
|
||||
if CanAccessStash() then
|
||||
openStash()
|
||||
end
|
||||
end,
|
||||
canInteract = function(entity, distance, data)
|
||||
return true
|
||||
end,
|
||||
},
|
||||
{
|
||||
icon = 'fa-solid fa-key',
|
||||
label = Lang('HOUSING_MENU_VAULT_SET_CODE'),
|
||||
action = function()
|
||||
OpenVaultCodeMenu()
|
||||
end,
|
||||
canInteract = function(entity, distance, data)
|
||||
if not CurrentHouseData.isOfficialOwner then return false end
|
||||
local houseData = Config.Houses[CurrentHouse]
|
||||
return table.includes(houseData.upgrades, 'vault')
|
||||
end,
|
||||
}
|
||||
},
|
||||
distance = 2.5
|
||||
})
|
||||
end
|
||||
|
||||
function Target:initLogout()
|
||||
local logout = CurrentHouseData.logout
|
||||
if not logout then return Debug('Target:initLogout ::: No logout coords') end
|
||||
exports[target_name]:AddBoxZone('house_logout', logout, Config.TargetLength, Config.TargetWidth, {
|
||||
name = 'house_logout',
|
||||
heading = 90.0,
|
||||
debugPoly = Config.ZoneDebug,
|
||||
minZ = logout.z - 15.0,
|
||||
maxZ = logout.z + 5.0,
|
||||
}, {
|
||||
options = {
|
||||
{
|
||||
icon = 'fa-solid fa-magnifying-glass',
|
||||
label = Lang('HOUSING_TARGET_LOGOUT_INTERACTION'),
|
||||
action = function()
|
||||
DoScreenFadeOut(250)
|
||||
while not IsScreenFadedOut() do Wait(10) end
|
||||
DespawnInterior(HouseObj, function()
|
||||
WeatherSyncEvent(false) -- Weather Events
|
||||
|
||||
local house = CurrentHouse
|
||||
SetEntityCoords(PlayerPed, Config.Houses[house].coords.enter.x, Config.Houses[house].coords.enter.y, Config.Houses[house].coords.enter.z + 0.5)
|
||||
SetEntityHeading(PlayerPed, Config.Houses[house].coords.enter.h)
|
||||
inOwned = false
|
||||
TriggerServerEvent('qb-houses:server:LogoutLocation')
|
||||
end)
|
||||
end,
|
||||
canInteract = function(entity, distance, data)
|
||||
return true
|
||||
end,
|
||||
},
|
||||
},
|
||||
distance = 2.5
|
||||
})
|
||||
end
|
||||
|
||||
function Target:init()
|
||||
for k, v in pairs(self.zones) do
|
||||
exports[target_name]:RemoveZone(v)
|
||||
end
|
||||
self.zones = {}
|
||||
exports[target_name]:RemoveTargetModel(lastMLODoors)
|
||||
for k, v in pairs(self.houses) do
|
||||
self:initOutside(k)
|
||||
self:initMLODoors(k)
|
||||
self:initExit(k)
|
||||
end
|
||||
end
|
||||
|
||||
function Target:initInsideInteractions()
|
||||
exports[target_name]:RemoveZone('house_wardrobe')
|
||||
exports[target_name]:RemoveZone('house_stash')
|
||||
exports[target_name]:RemoveZone('house_logout')
|
||||
Target:initWardrobe()
|
||||
Target:initStash()
|
||||
Target:initLogout()
|
||||
end
|
||||
|
||||
function Target:formatHouses()
|
||||
self.houses = table.filter(self.houses, function(house)
|
||||
return not house.apartmentNumber or house.apartmentNumber == 'apt-0'
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent('housing:initHouses', function(houseConfig)
|
||||
Target.houses = houseConfig
|
||||
Target:formatHouses()
|
||||
Target:init()
|
||||
if Target.initObjectInteractions then
|
||||
Target:initObjectInteractions()
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,8 @@
|
|||
if Config.Wardrobe ~= 'ak47_clothing' then
|
||||
return
|
||||
end
|
||||
|
||||
function openWardrobe()
|
||||
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
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
if Config.Wardrobe ~= 'codem-appearance' then
|
||||
return
|
||||
end
|
||||
|
||||
function openWardrobe()
|
||||
TriggerEvent('codem-apperance:OpenWardrobe')
|
||||
end
|
|
@ -0,0 +1,78 @@
|
|||
if Config.Wardrobe ~= 'default' then
|
||||
return
|
||||
end
|
||||
|
||||
function openWardrobe()
|
||||
if Config.Framework == 'qb' then
|
||||
return TriggerEvent('qb-clothing:client:openOutfitMenu')
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'room', {
|
||||
title = Lang('HOUSING_MENU_WARDROBE_DEFAULT_TITLE'),
|
||||
align = 'right',
|
||||
elements = {
|
||||
{ label = Lang('HOUSING_MENU_CLOTHES_MENU'), value = 'player_dressing' },
|
||||
{ label = Lang('HOUSING_MENU_DELETE_CLOTHES'), value = 'remove_cloth' }
|
||||
}
|
||||
}, function(data, menu)
|
||||
if data.current.value == 'player_dressing' then
|
||||
menu.close()
|
||||
TriggerServerCallback('qb-houses:server:getPlayerDressing', function(dressing)
|
||||
elements = {}
|
||||
|
||||
for i = 1, #dressing, 1 do
|
||||
table.insert(elements, {
|
||||
label = dressing[i],
|
||||
value = i
|
||||
})
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'player_dressing',
|
||||
{
|
||||
title = Lang('HOUSING_MENU_WARDROBE_DEFAULT_TITLE'),
|
||||
align = 'right',
|
||||
elements = elements
|
||||
}, function(data2, menu2)
|
||||
TriggerEvent('skinchanger:getSkin', function(skin)
|
||||
TriggerServerCallback('qb-houses:server:getPlayerOutfit', function(clothes)
|
||||
TriggerEvent('skinchanger:loadClothes', skin, clothes)
|
||||
TriggerEvent('esx_skin:setLastSkin', skin)
|
||||
|
||||
TriggerEvent('skinchanger:getSkin', function(skin)
|
||||
TriggerServerEvent('esx_skin:save', skin)
|
||||
end)
|
||||
end, data2.current.value)
|
||||
end)
|
||||
end, function(data2, menu2)
|
||||
menu2.close()
|
||||
end)
|
||||
end)
|
||||
elseif data.current.value == 'remove_cloth' then
|
||||
menu.close()
|
||||
TriggerServerCallback('qb-houses:server:getPlayerDressing', function(dressing)
|
||||
elements = {}
|
||||
|
||||
for i = 1, #dressing, 1 do
|
||||
table.insert(elements, {
|
||||
label = dressing[i],
|
||||
value = i
|
||||
})
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'remove_cloth', {
|
||||
title = Lang('HOUSING_MENU_DELETE_CLOTHES'),
|
||||
align = 'right',
|
||||
elements = elements
|
||||
}, function(data2, menu2)
|
||||
menu2.close()
|
||||
TriggerServerEvent('qb-houses:server:removeOutfit', data2.current.value)
|
||||
Notification(Lang('HOUSING_NOTIFICATION_OUTFIT_DELETE'), 'inform')
|
||||
end, function(data2, menu2)
|
||||
menu2.close()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
if Config.Wardrobe ~= 'fivem-appearance' then
|
||||
return
|
||||
end
|
||||
|
||||
function openWardrobe()
|
||||
exports['fivem-appearance']:openWardrobe()
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
if Config.Wardrobe ~= 'illenium-appearance' then
|
||||
return
|
||||
end
|
||||
|
||||
function openWardrobe()
|
||||
TriggerEvent('illenium-appearance:client:openOutfitMenu')
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
if Config.Wardrobe ~= 'mAppearance' then
|
||||
return
|
||||
end
|
||||
|
||||
function openWardrobe()
|
||||
TriggerEvent('codem-appearance:OpenWardrobe')
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
if Config.Wardrobe ~= 'qb-clothing' then
|
||||
return
|
||||
end
|
||||
|
||||
function openWardrobe()
|
||||
TriggerEvent('qb-clothing:client:openOutfitMenu')
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
if Config.Wardrobe ~= 'qs-appearance' then
|
||||
return
|
||||
end
|
||||
|
||||
function OpenClotheMenu()
|
||||
TriggerEvent('clothing:openOutfitMenu')
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
if Config.Wardrobe ~= 'raid_clothes' then
|
||||
return
|
||||
end
|
||||
|
||||
function openWardrobe()
|
||||
TriggerEvent('raid_clothes:openmenu')
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
if Config.Wardrobe ~= 'rcore_clothes' then
|
||||
return
|
||||
end
|
||||
|
||||
function openWardrobe()
|
||||
TriggerEvent('rcore_clothes:openOutfits')
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
if Config.Wardrobe ~= 'rcore_clothing' then
|
||||
return
|
||||
end
|
||||
|
||||
function openWardrobe()
|
||||
TriggerEvent('rcore_clothing:openChangingRoom')
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
if Config.Wardrobe ~= 'sleek-clothestore' then
|
||||
return
|
||||
end
|
||||
|
||||
function openWardrobe()
|
||||
exports['sleek-clothestore']:OpenWardrobe()
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
if Config.Wardrobe ~= 'tgiann-clothing' then
|
||||
return
|
||||
end
|
||||
|
||||
function openWardrobe()
|
||||
TriggerEvent('tgiann-clothing:openOutfitMenu')
|
||||
end
|
|
@ -0,0 +1,18 @@
|
|||
-- Function to manage weather synchronization
|
||||
function WeatherSyncEvent(isSyncEnabled)
|
||||
if isSyncEnabled then
|
||||
-- Disable weather synchronization (entering a house)
|
||||
TriggerEvent('qb-weathersync:client:DisableSync')
|
||||
TriggerEvent('cd_easytime:PauseSync', true)
|
||||
TriggerEvent('vSync:toggle', true)
|
||||
TriggerEvent('av_weather:freeze', true, 23, 0, "CLEAR", false, false, false)
|
||||
Debug("Weather synchronization disabled.")
|
||||
else
|
||||
-- Enable weather synchronization (exiting a house)
|
||||
TriggerEvent('qb-weathersync:client:EnableSync')
|
||||
TriggerEvent('cd_easytime:PauseSync', false)
|
||||
TriggerEvent('vSync:toggle', false)
|
||||
TriggerEvent('av_weather:freeze', false)
|
||||
Debug("Weather synchronization enabled.")
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue