diff --git a/README - INSTALL INSTRUCTIONS/QBCore/README.md b/README - INSTALL INSTRUCTIONS/QBCore/README.md index 76515c7..1289e84 100644 --- a/README - INSTALL INSTRUCTIONS/QBCore/README.md +++ b/README - INSTALL INSTRUCTIONS/QBCore/README.md @@ -168,7 +168,7 @@ RegisterNUICallback('spawnplayer', function(data, cb) TriggerServerEvent('QBCore:Server:OnPlayerLoaded') TriggerEvent('QBCore:Client:OnPlayerLoaded') local property_id = data.spawnloc.property_id - TriggerServerEvent('ps-housing:server:enterProperty', tostring(property_id)) + TriggerServerEvent('ps-housing:server:enterProperty', tostring(property_id), 'spawn') PostSpawnPlayer() elseif type == "normal" then local pos = QB.Spawns[location].coords diff --git a/README - INSTALL INSTRUCTIONS/QBOX/README.md b/README - INSTALL INSTRUCTIONS/QBOX/README.md index e50fb5f..610013c 100644 --- a/README - INSTALL INSTRUCTIONS/QBOX/README.md +++ b/README - INSTALL INSTRUCTIONS/QBOX/README.md @@ -121,7 +121,7 @@ local function inputHandler() local spawnData = spawns[currentButtonID] if spawnData.propertyId then - TriggerServerEvent('ps-housing:server:enterProperty', tostring(spawnData.propertyId)) + TriggerServerEvent('ps-housing:server:enterProperty', tostring(spawnData.propertyId), 'spawn') else SetEntityCoords(cache.ped, spawnData.coords.x, spawnData.coords.y, spawnData.coords.z, false, false, false, false) SetEntityHeading(cache.ped, spawnData.coords.w or 0.0) diff --git a/client/cl_property.lua b/client/cl_property.lua index 8177223..6d36602 100644 --- a/client/cl_property.lua +++ b/client/cl_property.lua @@ -909,9 +909,16 @@ function Property.Get(property_id) return PropertiesTable[tostring(property_id)] end -RegisterNetEvent("ps-housing:client:enterProperty", function(property_id) +RegisterNetEvent("ps-housing:client:enterProperty", function(property_id, spawn) local property = Property.Get(property_id) - property:EnterShell() + if spawn == 'spawn' then + local data = lib.callback.await("ps-housing:cb:getMainMloDoor", false, property_id, 1) + if not data then property:EnterShell() return end + SetEntityCoords(PlayerPedId(), data.objCoords.x, data.objCoords.y, data.objCoords.z) + return + else + property:EnterShell() + end end) RegisterNetEvent("ps-housing:client:updateDoorbellPool", function(property_id, data) diff --git a/server/sv_property.lua b/server/sv_property.lua index 1fe2df2..b0ae870 100644 --- a/server/sv_property.lua +++ b/server/sv_property.lua @@ -41,8 +41,8 @@ function Property:PlayerEnter(src) if not isMlo then TriggerClientEvent('qb-weathersync:client:DisableSync', src) end - - TriggerClientEvent('ps-housing:client:enterProperty', src, self.property_id) + print(src, self.property_id) + TriggerClientEvent('ps-housing:client:enterProperty', src, self.property_id, isMlo, self.propertyData) if next(self.playersDoorbell) then TriggerClientEvent("ps-housing:client:updateDoorbellPool", src, self.property_id, self.playersDoorbell) @@ -565,12 +565,11 @@ RegisterNetEvent('ps-housing:server:enterGarden', function (property_id) property.playersInGarden[tostring(src)] = true end) -RegisterNetEvent('ps-housing:server:enterProperty', function (property_id) +RegisterNetEvent('ps-housing:server:enterProperty', function (property_id, spawn) local src = source Debug("Player is trying to enter property", property_id) local property = Property.Get(property_id) - if not property then Debug("Properties returned", json.encode(PropertiesTable, {indent = true})) return @@ -580,7 +579,11 @@ RegisterNetEvent('ps-housing:server:enterProperty', function (property_id) if property:CheckForAccess(citizenid) then Debug("Player has access to property") - property:PlayerEnter(src) + if spawn == 'spawn' then + TriggerClientEvent("ps-housing:client:enterProperty", src, property_id, spawn) + else + property:PlayerEnter(src) + end Debug("Player entered property") return end @@ -796,7 +799,11 @@ RegisterNetEvent("ps-housing:server:buyFurniture", function(property_id, items, if item.type == 'storage' then local stashName = ("property_%s"):format(propertyData.property_id) local stashConfig = Config.Shells[propertyData.shell].stash - Framework[Config.Inventory].RegisterInventory(firstStorage and stashName or stashName..item.id, 'Property: ' .. propertyData.street .. ' #'.. propertyData.property_id or propertyData.apartment or stashName, stashConfig) + if not propertyData.apartment then + Framework[Config.Inventory].RegisterInventory(firstStorage and stashName or stashName .. item.id, 'Property: ' .. propertyData.street .. '#' .. propertyData.property_id, stashConfig) + else + Framework[Config.Inventory].RegisterInventory(firstStorage and stashName or stashName .. item.id, 'Property: ' .. propertyData.apartment .. '#' .. propertyData.property_id, stashConfig) + end end numFurnitures = numFurnitures + 1 propertyData.furnitures[numFurnitures] = item diff --git a/shared/config.lua b/shared/config.lua index 0e03766..69ce206 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -10,7 +10,7 @@ Config = {} Config.Target = "qb" -- "ox" or "qb" Config.Notify = "qb" -- "ox" or "qb" Config.Radial = "qb" -- "ox" or "qb" -Config.Inventory = "ox" -- "ox" or "qb" +Config.Inventory = "qb" -- "ox" or "qb" Config.Logs = "qb" -- "qb" -- Anyone provided with keys to a property has the ability to modify its furnishings.