ps-housing is a resource that opens up a world of creative possibilities for housing. Its user-friendly interface lets you decorate any location to your heart's content. The best part? Not only is it completely free, but it's also reliable and functional, unlike many other housing systems available. Dive in and start transforming spaces with ps-housing today!
ps-housing owes its existence to the exceptional coding expertise of Xirvin#0985. His application of top-tier coding practices has been instrumental in creating this script. We at Project Sloth are thrilled that he has joined our team and utilized our platform to deliver this incredible, much-anticipated resource. Our sincere appreciation goes out to Xirvin#0985 for his outstanding contribution!
Preview ps-housing
Preview ps-realtor
- Players can decorate their houses and apartments with a full selection of furniture and decorations (included a wide variety of custom housing props)
- Provides support for housing and apartments and is a full replacement for qb-apartments and qb-housing
- When a player first spawns after enabling ps-housing, they will have to choose an apartment. Once they spawn in the stashitems from their previous qb-apartment will be migrated to their new apartment stash.
- Allows players to purchase and list houses for sale through
ps-realtor
and the realtor job - Houses come with personal garages
- Houses and apartments come with personal wardrobes and stashes
- Players can share keys to their houses and apartments with other players
Players must have the realtor job to create new properties. Additionally if the realtor has a high enough grade level, they can also help players move to new apartments. All properties must be manually configured for sale by the realtor job, giving you full control over all aspects of properties, and bringing another avenue of roleplay to your server.
- Pick the location where you want to create a new property
- Use
/housing
to open the housing menu - Click on create new property
- Fill out the details of the property (name, price, description, which shell to use, etc)
- Choose the door location (this is where the person will enter the house)
- Ensure that you place it up against a wall, since players will use target to enter the house
- Choose the garage location
- This point is used both for storing vehicles, as well as the location where the vehicle will spawn when taken out of the garage
- Realtors can edit the details of the property by clicking on the property in the housing menu
- Players can see the properties for sale through the /housing menu as well
Once inside the property, the player can furnish and decorate the property to their liking. They can also invite other players to their property, and give them access to the property. Open the furniture store by pressing Z
.
This will open a furniture store complete with all of the props. Select an item from the catalog and place it into the property. You can use the placement gizmo to position the item to your liking as well as use the UI tools for fine tune control over the placement. Once you are happy with the positioning, make sure you press Add to Cart
before moving on. Continue to add as many items as you want to your cart. Once you are done, go to the Checkout
and purchase the items.
Note: The place on ground button sometimes does not work properly depending on where the native detects the ground to be.
Dynamic Doors will turn placed doors into actual working doors, Instead of them being static. (See videos below)
DynamicDoorsOff.mp4
DynamicDoorsOn.mp4
- You will need to set the
Config.DynamicDoors = true
- You will have to add this convar into your server.cfg
setr game_enableDynamicDoorCreation "true"
Note: The convar has to be in your server.cfg in order for the doors to be dynamic!
-
Players need to place their stash and wardrobe or else they wont have one. Check Config for more information.
-
This entire README is meant for compatibility with default QBCore scripts. If you have different scripts, you'll need to adjust them for compatibility yourself. Refrain from asking us how to circumvent paid scripts that can't be adjusted for ps-housing support. Instead, request their support for ps-housing - this script is fully open source for that reason. Any inquiries related to this be ignored.
Kamaryn has created an amazing setup video located here.
qb-multicharacter > server > main.lua
RegisterNetEvent('qb-multicharacter:server:loadUserData', function(cData)
local src = source
if QBCore.Player.Login(src, cData.citizenid) then
local Player = QBCore.Functions.GetPlayer(src)
local Name = Player.PlayerData.charinfo.firstname .. " " .. Player.PlayerData.charinfo.lastname
repeat
Wait(10)
until hasDonePreloading[src]
print('[' .. GetPlayerName(src) .. '] - ^2' .. Name .. '^7 (Citizen ID: ' .. cData.citizenid .. ') has succesfully loaded!')
QBCore.Commands.Refresh(src)
if Config.SkipSelection then
local coords = json.decode(cData.position)
TriggerClientEvent('qb-multicharacter:client:spawnLastLocation', src, coords, cData)
else
TriggerClientEvent('ps-housing:client:setupSpawnUI', src, cData)
end
TriggerEvent("qb-log:server:CreateLog", "joinleave", "Loaded", "green", "**" .. GetPlayerName(src) .. "** - " .. Name .. " (<@" .. (QBCore.Functions.GetIdentifier(src, 'discord'):gsub("discord:", "") or "unknown") .. "> | ||" .. (QBCore.Functions.GetIdentifier(src, 'ip') or 'undefined') .. "|| | " .. (QBCore.Functions.GetIdentifier(src, 'license') or 'undefined') .. " | " .. cData.citizenid .. " | " .. src .. ") loaded..")
end
end)
qb-multicharacter > server > main.lua
RegisterNetEvent('qb-multicharacter:server:createCharacter', function(data)
local src = source
local newData = {}
newData.cid = data.cid
newData.charinfo = data
if QBCore.Player.Login(src, false, newData) then
repeat
Wait(10)
until hasDonePreloading[src]
print('^2[qb-core]^7 '..GetPlayerName(src)..' has succesfully loaded!')
QBCore.Commands.Refresh(src)
TriggerClientEvent("qb-multicharacter:client:closeNUI", src)
newData.citizenid = QBCore.Functions.GetPlayer(src).PlayerData.citizenid
TriggerClientEvent('ps-housing:client:setupSpawnUI', src, newData)
GiveStarterItems(src)
end
end)
qb-multicharacter > client > main.lua
RegisterNetEvent('qb-multicharacter:client:spawnLastLocation', function(coords, cData)
local result = lib.callback.await('ps-housing:cb:GetOwnedApartment', source, cData.citizenid)
if result then
TriggerEvent("apartments:client:SetHomeBlip", result.type)
end
local ped = PlayerPedId()
SetEntityCoords(ped, coords.x, coords.y, coords.z)
SetEntityHeading(ped, coords.w)
FreezeEntityPosition(ped, false)
SetEntityVisible(ped, true)
local PlayerData = QBCore.Functions.GetPlayerData()
local insideMeta = PlayerData.metadata["inside"]
DoScreenFadeOut(500)
if insideMeta.propertyId then
TriggerServerEvent('ps-housing:server:enterProperty', tostring(insideMeta.propertyId))
else
SetEntityCoords(ped, coords.x, coords.y, coords.z)
SetEntityHeading(ped, coords.w)
FreezeEntityPosition(ped, false)
SetEntityVisible(ped, true)
end
TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
TriggerEvent('QBCore:Client:OnPlayerLoaded')
Wait(2000)
DoScreenFadeIn(250)
end)
qb-spawn > client.lua > line 51 > 'qb-spawn:client:setupSpawns' event
RegisterNetEvent('qb-spawn:client:setupSpawns', function(cData, new, apps)
if not new then
QBCore.Functions.TriggerCallback('qb-spawn:server:getOwnedHouses', function(houses)
local myHouses = {}
if houses ~= nil then
for i = 1, (#houses), 1 do
local house = houses[i]
myHouses[#myHouses+1] = {
house = house,
label = (house.apartment or house.street) .. " " .. house.property_id,
}
end
end
Wait(500)
SendNUIMessage({
action = "setupLocations",
locations = QB.Spawns,
houses = myHouses,
isNew = new
})
end, cData.citizenid)
elseif new then
SendNUIMessage({
action = "setupAppartements",
locations = apps,
isNew = new
})
end
end)
qb-spawn > client.lua > line 134 > 'chooseAppa' NUI Callback
RegisterNUICallback('chooseAppa', function(data, cb)
local ped = PlayerPedId()
local appaYeet = data.appType
SetDisplay(false)
DoScreenFadeOut(500)
Wait(100)
FreezeEntityPosition(ped, false)
RenderScriptCams(false, true, 0, true, true)
SetCamActive(cam, false)
DestroyCam(cam, true)
SetCamActive(cam2, false)
DestroyCam(cam2, true)
SetEntityVisible(ped, true)
Wait(500)
TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
TriggerEvent('QBCore:Client:OnPlayerLoaded')
Wait(100)
TriggerServerEvent("ps-housing:server:createNewApartment", appaYeet)
cb('ok')
end)
qb-spawn > client > client.lua > line 169 'spawnplayer' NUI Callback
RegisterNUICallback('spawnplayer', function(data, cb)
local location = tostring(data.spawnloc)
local type = tostring(data.typeLoc)
local ped = PlayerPedId()
local PlayerData = QBCore.Functions.GetPlayerData()
local insideMeta = PlayerData.metadata["inside"]
if type == "current" then
PreSpawnPlayer()
QBCore.Functions.GetPlayerData(function(pd)
ped = PlayerPedId()
SetEntityCoords(ped, pd.position.x, pd.position.y, pd.position.z)
SetEntityHeading(ped, pd.position.a)
FreezeEntityPosition(ped, false)
end)
TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
TriggerEvent('QBCore:Client:OnPlayerLoaded')
if insideMeta.property_id ~= nil then
local property_id = insideMeta.property_id
TriggerServerEvent('ps-housing:server:enterProperty', tostring(property_id))
end
PostSpawnPlayer()
elseif type == "house" then
PreSpawnPlayer()
TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
TriggerEvent('QBCore:Client:OnPlayerLoaded')
local property_id = data.spawnloc.property_id
TriggerServerEvent('ps-housing:server:enterProperty', tostring(property_id))
PostSpawnPlayer()
elseif type == "normal" then
local pos = QB.Spawns[location].coords
PreSpawnPlayer()
SetEntityCoords(ped, pos.x, pos.y, pos.z)
TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
TriggerEvent('QBCore:Client:OnPlayerLoaded')
TriggerServerEvent('ps-housing:server:resetMetaData')
SetEntityCoords(ped, pos.x, pos.y, pos.z)
SetEntityHeading(ped, pos.w)
PostSpawnPlayer()
end
cb('ok')
end)
qb-spawn > server.lua > line 3
QBCore.Functions.CreateCallback('qb-spawn:server:getOwnedHouses', function(_, cb, cid)
if cid ~= nil then
local houses = MySQL.query.await('SELECT * FROM properties WHERE owner_citizenid = ?', {cid})
if houses[1] ~= nil then
cb(houses)
else
cb({})
end
else
cb({})
end
end)
qb-garages > server > main.lua > around line 120
on event qb-garage:server:checkOwnership
Replace
local hasHouseKey = exports['qb-houses']:hasKey(result[1].license, result[1].citizenid, house)
With
local hasHouseKey = exports['ps-housing']:IsOwner(src, house)
qb-garages > client > main.lua > around line 451
add under event qb-garages:client:addHouseGarage
RegisterNetEvent('qb-garages:client:removeHouseGarage', function(house)
Config.HouseGarages[house] = nil
end)
qb-garages > server > main.lua > around line 118
on event qb-garages:server:canDeposit
Replace
if type == 'house' and not exports['qb-houses']:hasKey(Player.PlayerData.license, Player.PlayerData.citizenid, Config.HouseGarages[garage].label) then
With
if type == 'house' and not exports['ps-housing']:IsOwner(source, garage) then
qb-garages > client > main.lua > around line 392
add under event qb-garages:client:addHouseGarage
RegisterNetEvent('qb-garages:client:removeHouseGarage', function(house)
Config.Garages[house] = nil
end)
5. Run the properties.sql
file, but be cautious. If a table named properties
already exists in your database, this operation will drop it, resulting in the loss of all its data.
6. Delete default qb-apartments
7. Delete default qb-houses
8. Delete qb-apartments/config.lua
references in qb-spawn
, qb-multicharacter
and qb-phone
fxmanifest.lua (and any other scripts that may reference it).
- ps-realtor
- fivem-freecam
- ox_lib - Use the latest release. If you do not use the latest release, MAKE SURE TO BUILD THE UI. Find their docs here on how to build the UI.
- ox_target or qb-target - Change in Config, default is qb-target.
- We highly recommend making a folder named [ps-housing] and add
ps-realtor
,fivem-freecam
,ox_lib
,ps-core
,ps-housing
inside the folder.
ensure ox_lib
ensure ps-housing
ensure ps-realtor
ensure fivem-freecam
-
From a client run the
migratehouses
command to automatically convert all houses from qb-houses. It will print a message to the console once complete. Themigratehouses
command MUST be run from a client in order to retrieve street and region data for each house -
From a client or server console run the
migrateapartments
command to automatically convert all apartments from qb-apartments. It will print a message to the console once complete.
If you come across an error such as Foreign key constraint is incorrectly formed
while importing the properties.sql
into your database, follow these steps to fix it.
- Open your database in HeidiSQL.
- Right-click on your database name and select "Edit."
- Locate the database collation setting take a note of it.
- You will need to format the
properties.sql
file to match your database collation. - Ensure that the collation of your
citizenid
column in yourplayers
table isutf8mb4_general_ci
and notutf8mb4_unicode_ci
If your database collation is set to utf8mb4_general_ci
, modify the last line of the properties.sql
file using VSCode or in HeidiSQL's query tab to the following:
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
This adjustment ensures that properties.sql
file's character set and collation match that of your database, effectively resolving the issue.
- Choose an item you want to limit under
Config.Furniture
in undershared/config.lua
- Add
["max"] = 3
or the number of your choice to the item (see example below)
{ ["object"] = "v_res_r_figcat", ["price"] = 300, ["max"] = 2, ["label"] = "Fig Cat" },
- Go to
qb-smallresources/server/logs.lua
and add this:
['pshousing'] = 'yourdiscordwebhookhere',
- Create a webhook for the channel you want the logs to show up in.
- Replace the placeholder with your webhook link.
This system only supports qb-core for now.
- Follow the ps-housing wiki information.
- If a player is in their apartment/house and an admin does a "Bring to me" function, they will not see the player nor will the player see anyone else. This is because the player is still in their own unique routing bucket. Workaround: To fix this, the player must go back into their apartment and leave on their own.
- Likewise, if an admin tries to "Go to" or "Spectate" a player that is in their apartment/house, the admin will not be able to see the apartment or player because it is in a different routing bucket.