From be7e4df0d291d30deb0140d724bf1dab2e0d1310 Mon Sep 17 00:00:00 2001 From: Walter Date: Sat, 25 Nov 2023 15:34:12 +0100 Subject: [PATCH 1/4] fix(#140): Should fix target zone not getting removed when using OX --- client/cl_property.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/cl_property.lua b/client/cl_property.lua index 5fb53b2..1780f84 100644 --- a/client/cl_property.lua +++ b/client/cl_property.lua @@ -534,9 +534,12 @@ function Property:RemoveBlip() end function Property:RemoveProperty() - local targetName = string.format("%s_%s", self.propertyData.street, self.property_id) - - Framework[Config.Target].RemoveTargetZone(targetName) + if Config.Target == "ox" then + Framework[Config.Target].RemoveTargetZone(self.entranceTarget) + else + local targetName = string.format("%s_%s", self.propertyData.street, self.property_id) + Framework[Config.Target].RemoveTargetZone(targetName) + end self:RemoveBlip() From b02c12a572b2aa923c069b86a5f1806906e3e5a2 Mon Sep 17 00:00:00 2001 From: Walter Date: Sat, 25 Nov 2023 15:40:13 +0100 Subject: [PATCH 2/4] Fix(#48): Garage location should now update after moving it --- server/sv_property.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/sv_property.lua b/server/sv_property.lua index 8896c18..720067d 100644 --- a/server/sv_property.lua +++ b/server/sv_property.lua @@ -417,7 +417,7 @@ function Property:UpdateGarage(data) ["@property_id"] = self.property_id }) - TriggerClientEvent("ps-housing:client:updateProperty", -1, "UpdateGarage", self.property_id, garage) + TriggerClientEvent("ps-housing:client:updateProperty", -1, "UpdateGarage", self.property_id, newData) Framework[Config.Logs].SendLog("**Changed Garage** of property with id: " .. self.property_id .. " by: " .. GetPlayerName(realtorSrc)) From c3c735e00a66fee40be7151156da153a95a57aa1 Mon Sep 17 00:00:00 2001 From: Walter Date: Sat, 25 Nov 2023 15:53:29 +0100 Subject: [PATCH 3/4] Fix(#121): Should now show character creation even if not using starter apparments --- server/server.lua | 19 ++++++++++++++++++- shared/config.lua | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/server/server.lua b/server/server.lua index 17dd19a..58e568a 100644 --- a/server/server.lua +++ b/server/server.lua @@ -138,8 +138,8 @@ end) RegisterNetEvent("ps-housing:server:createNewApartment", function(aptLabel) local src = source - if not Config.StartingApartment then return end local citizenid = GetCitizenid(src) + if not Config.StartingApartment then return end local PlayerData = GetPlayerData(src) local apartment = Config.Apartments[aptLabel] @@ -160,6 +160,23 @@ RegisterNetEvent("ps-housing:server:createNewApartment", function(aptLabel) TriggerEvent("ps-housing:server:registerProperty", propertyData) end) +-- we show the character creator if they spawn without starting appartment and doesn't have skin set +RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function() + if Config.StartingApartment then return end + + local src = source + local citizenid = GetCitizenid(src) + local query = "SELECT skin FROM playerskins WHERE citizenid = ?" + local result = MySQL.Sync.fetchAll(query, {citizenid}) + + if result and result[1] then + Debug("Player: " .. citizenid .. " skin already exists!") + else + TriggerClientEvent("qb-clothes:client:CreateFirstCharacter", src) + Debug("Player: " .. citizenid .. " is creating a new character!") + end +end) + -- Creates apartment stash -- If player has an existing apartment from qb-apartments, it will transfer the items over to the new apartment stash RegisterNetEvent("ps-housing:server:createApartmentStash", function(citizenId, propertyId) diff --git a/shared/config.lua b/shared/config.lua index 8e89ba3..caed04c 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -65,6 +65,9 @@ Config.Commissions = { -- Set this value to false if you don't want to assign a starting apartment. Config.StartingApartment = true +--- With this enabled, the customizer will open when starting apartment is false. +Config.ShowCustomizerWhenNoStartingApartment = true + Config.Apartments = { ["Integrity Way"] = { label = "Integrity Way", From 3f3a54806077eba545277258fe63b46001e40215 Mon Sep 17 00:00:00 2001 From: Walter Date: Sat, 25 Nov 2023 16:11:08 +0100 Subject: [PATCH 4/4] fix(#154): Should now be able to assign appartments when not having one already --- server/server.lua | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/server/server.lua b/server/server.lua index 58e568a..bf44d2b 100644 --- a/server/server.lua +++ b/server/server.lua @@ -41,7 +41,7 @@ lib.callback.register("ps-housing:server:requestProperties", function(source) return PropertiesTable end) -AddEventHandler("ps-housing:server:registerProperty", function (propertyData) -- triggered by realtor job +AddEventHandler("ps-housing:server:registerProperty", function (propertyData, preventEnter) -- triggered by realtor job local propertyData = propertyData propertyData.owner = propertyData.owner or nil @@ -75,7 +75,7 @@ AddEventHandler("ps-housing:server:registerProperty", function (propertyData) -- TriggerClientEvent("ps-housing:client:addProperty", -1, propertyData) - if propertyData.apartment then + if propertyData.apartment and not preventEnter then local player = QBCore.Functions.GetPlayerByCitizenId(propertyData.owner) local src = player.PlayerData.source @@ -219,13 +219,39 @@ AddEventHandler("ps-housing:server:addTenantToApartment", function (data) Framework[Config.Notify].Notify(targetSrc, "This person is already in this apartment", "error") return - elseif #propertyData.apartment > 1 then + elseif propertyData.apartment and #propertyData.apartment > 1 then property_id = propertyData.property_id break end end end + if property_id == nil then + local newApartment = Config.Apartments[apartment] + if not newApartment then return end + + local citizenid = GetCitizenid(targetSrc, realtorSrc) + local targetToAdd = QBCore.Functions.GetPlayerByCitizenId(citizenid).PlayerData + local propertyData = { + owner = targetCitizenid, + description = string.format("This is %s's apartment in %s", targetToAdd.charinfo.firstname .. " " .. targetToAdd.charinfo.lastname, apartment.label), + for_sale = 0, + shell = newApartment.shell, + apartment = newApartment.label, + } + + Debug("Creating new apartment for " .. GetPlayerName(targetSrc) .. " in " .. newApartment.label) + + Framework[Config.Logs].SendLog("Creating new apartment for " .. GetPlayerName(targetSrc) .. " in " .. newApartment.label) + + Framework[Config.Notify].Notify(targetSrc, "Your apartment is now at "..apartment, "success") + Framework[Config.Notify].Notify(realtorSrc, "You have added ".. targetToAdd.charinfo.firstname .. " " .. targetToAdd.charinfo.lastname .. " to apartment "..apartment, "success") + + TriggerEvent("ps-housing:server:registerProperty", propertyData, true) + + return + end + local property = Property.Get(property_id) if not property then return end