Giter Club home page Giter Club logo

ps-housing's Introduction

ps-housing

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

image image image image

Preview ps-realtor

image image image image image

Usage

  • 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

Creating a new property for sale

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

Furnish and decorate a property

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

Dynamic Doors will turn placed doors into actual working doors, Instead of them being static. (See videos below)

Preview

DynamicDoorsOff.mp4
DynamicDoorsOn.mp4

Setup

  • 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!

Shell Support

Important

  • 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.

Installation

Kamaryn has created an amazing setup video located here.

PAY ATTENTION TO EACH STEP. DO NOT SKIP ANY.

1. Find the following events in qb-multicharacter and change in server/main.lua event to:

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)

2. Find the following event in qb-multicharacter and change in client/main.lua event to:

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)

3. Find the following events in qb-spawn and change in client/client.lua event to:

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)

4. Find the following events in qb-garages and change:

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)

For qb-garages v2:

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).

9. Ensure ps-realtor above ps-housing.

10. In your server.cfg, add ensure ox_lib above all other resources

11. Install the dependencies below.

Dependencies

  1. ps-realtor
  2. fivem-freecam
  3. 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.
  4. ox_target or qb-target - Change in Config, default is qb-target.

For reference your server.cfg should be ensured like below:

  • 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

End of Installation

Migrating houses and apartments from qb-houses and qb-apartments

  1. 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. The migratehouses command MUST be run from a client in order to retrieve street and region data for each house

  2. 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.

Resolving the "Foreign key constraint is incorrectly formed" Issue

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.

  1. Open your database in HeidiSQL.
  2. Right-click on your database name and select "Edit."
  3. Locate the database collation setting take a note of it.
  4. You will need to format the properties.sql file to match your database collation.
  5. Ensure that the collation of your citizenid column in your players table is utf8mb4_general_ci and not utf8mb4_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.

Item Limits System

  1. Choose an item you want to limit under Config.Furniture in under shared/config.lua
  2. 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" },

Logs System Setup

  1. Go to qb-smallresources/server/logs.lua and add this:
    ['pshousing'] = 'yourdiscordwebhookhere',
  1. Create a webhook for the channel you want the logs to show up in.
  2. Replace the placeholder with your webhook link.

This system only supports qb-core for now.

Adding New Shells

Notes

  • 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.

Credits

ps-housing's People

Contributors

1b0y avatar alp1x avatar backsh00ter avatar complexza avatar epkouhia avatar evenhfo avatar ilickpandas21 avatar imxirvin avatar itzmuri avatar jnktechstuff avatar lesiin avatar martinator9001 avatar mekz1222 avatar monkeywhisper avatar monsieurbibo avatar nateistyping avatar nietthijmen avatar ogidevs avatar ok1ez avatar pulsepk avatar pushkart2 avatar ruby-lk avatar switchgh avatar thummie avatar walter-00 avatar wlvf avatar xfutte avatar xsisyphusx avatar xxjamiexx avatar z0nzjn123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ps-housing's Issues

qb-target issue (even default qb-target)

i tried with kevingirardx's target and default one, both throw the same error regardless

error comes out when I try to get into my apartment, but its fine when going out of it

[     63985] [b2802_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @ps-housing/shared/framework.lua:124: attempt to call a nil value (global 'hasApartment')^7
[     63985] [b2802_GTAProce]             MainThrd/ ^3> ref^7 (^5@ps-housing/shared/framework.lua^7:124)
[     63985] [b2802_GTAProce]             MainThrd/ ^3> CheckOptions^7 (^5@qb-target/init.lua^7:222)
[     63985] [b2802_GTAProce]             MainThrd/ ^3> SetupOptions^7 (^5@qb-target/client.lua^7:184)
[     63985] [b2802_GTAProce]             MainThrd/ ^3> fn^7 (^5@qb-target/client.lua^7:392)
[     63985] [b2802_GTAProce]             MainThrd/ ^1SCRIPT ERROR: error object is not a string^7

help

i cant insert the database how to fix this?

image

After selecting properties when flying into it

image

[ 348172] [b2802_GTAProce] CrBrowserMain/ Uncaught TypeError: Cannot read properties of null (reading 'focus') (@game/ui/root.html:108)
[ 369969] [b2802_GTAProce] MainThrd/ Initialising properties
[ 370047] [b2802_GTAProce] MainThrd/ Error running call reference function for resource ps-housing: citizen:/scripting/lua/scheduler.lua:520: type cannot be msgpack'd
[ 370047] [b2802_GTAProce] MainThrd/ stack traceback:
[ 370047] [b2802_GTAProce] MainThrd/ [C]: in function 'msgpack.pack'
[ 370047] [b2802_GTAProce] MainThrd/ citizen:/scripting/lua/scheduler.lua:520: in function citizen:/scripting/lua/scheduler.lua:482
[ 370047] [b2802_GTAProce] MainThrd/ [C]: in field 'CreateThreadNow'
[ 370047] [b2802_GTAProce] MainThrd/ citizen:/scripting/lua/scheduler.lua:198: in function citizen:/scripting/lua/scheduler.lua:148
[ 370047] [b2802_GTAProce] MainThrd/ ^1SCRIPT ERROR: @bl-realtor/client/sync.lua:5:
[ 370047] [b2802_GTAProce] MainThrd/ ^5 An error occurred while calling export GetProperties in resource ps-housing:
[ 370047] [b2802_GTAProce] MainThrd/
[ 370047] [b2802_GTAProce] MainThrd/ ^5 ---^7
[ 370047] [b2802_GTAProce] MainThrd/ ^3> handler^7 (^5@ps-housing/client/client.lua^7:30)
[ 370047] [b2802_GTAProce] MainThrd/ Initialised properties

Shared property access does not grant access to the property's garage

If you give someone access to your property, they will not have access to your property's garage. Only the owner has access to the garage.

I think the garage should function similar to a shared gang garage, but only for the people who have access to this property.

To implement this we need to look more into how we are creating the garage through qb-garages. I know it supports giving job/gangs a shared garage, not sure if it has default support for giving access to a list of citizenIds tho

black screen but full loaded in

https://prnt.sc/EpSPHzMMKbsZ

i have the error above i have tried to do this on a clean server with nothing but defualts and i have did the read me 100% correct any ideas on why this would still be happening and its only happening when the ps-housing is add workf fine before

I can't plant weed in my house

I am using qb-weed and qb-drugs and when I try to plant a weed seed in my house it says "area not safe, try your house". Any help would be appreciated.

Ped flickering in shells.

Not entirely sure of the reproduce steps just yet, however this is the exact situation I noticed this in:

  1. Character owns 2 houses on this street.
  2. There's a difference of 1 house separating them (don't know if this matters, but see image: https://cdn.discordapp.com/attachments/1063024147996885043/1138945876186910760/image.png).
  3. House 2's interior (the same as house 1's) works just fine, with absolutely no flickering.
  4. House 1's interior, has flickering.
  5. No errors in both server/client console.

I suspect that it's got something to do with coords maybe? I'm not entirely sure. Haven't had a chance to look at it yet, was told to report it by MonkeyWhisper.

Video of house 1's flickering: https://youtu.be/wPLrsvybvjA
Video of house 2's perfectly fine interior (just for reference): https://youtu.be/nmTbcGfTjrw (don't find the floating objects, that's unrelated to this).

Garage heading placement is not respected

When you create a garage zone for your house you have a polyzone that shows the way the vehicle will be positioned.
When you pull the vehicle out of the garage, the vehicle always faces North, regardless of how you positioned the polyzone.

Ex:
image

image

Importing SQL to DB

When I tried to import the Properties.sql it shows the next error:

IMG_20230728_102554862

After I press OK show this:

IMG_20230728_102602559

I will appreciate any help with this. Thanks in advance.

Extra shells coding request

Hi,

Is it possible to add the code for the other shells in the qb-interior to ps-housing? Qb-interior has support for the other shells already if you have the shells themselves. See the example below:

...elseif Config.Houses[house].tier == 15 then
    return exports['qb-interior']:CreateWarehouse1(coords)
elseif Config.Houses[house].tier == 16 then
    return exports['qb-interior']:CreateFurniMotelStandard(coords) -- End of free shells
elseif Config.Houses[house].tier == 17 then
    return exports['qb-interior']:CreateMedium2(coords)
elseif Config.Houses[house].tier == 18 then
    return exports['qb-interior']:CreateMedium3(coords)...

Can we include support for the rest in ps-housing too, or at least advise me on what to change to get the rest imported? I'm guessing it's not as easy as adding the shell info into a template like this below.

  ["House Name"] = {
    label = "House Name",
    hash = `shell_name`,
    doorOffset = { x = 0.0, y = 0.0, z = 0.0, h = 0.0, width = 2.0  },
    stash = {
        maxweight = 0000, 
        slots = 20,
    },
    imgs = {
        {
            url = "https://....webp",
            label = "Angle 1",
        },           
    },
},

Also, how can the 'Select a Shell' menu option be edited so that the names are either alphabetical or ordered by similarity (like house 1, house 2, house 3, warehouse1, warehouse2, etc.) It doesn't seem to follow any logical order, like showing in the order in which it's declared in ps-housing?

Shell type

I have installed everything that is in the readme but I am not able to choose a shell type. Any fixes for it?

qb framework no qb-inventory

[   script:ps-housing] SCRIPT ERROR: @ps-housing/server/sv_property.lua:20: attempt to call a nil value (field 'RegisterInventory')
[   script:ps-housing] > new (@ps-housing/server/sv_property.lua:20)
[   script:ps-housing] > ref (@ps-housing/server/server.lua:29)
[   script:ps-housing] > <unknown> (@oxmysql/dist/build.js:21810)
[   script:ps-housing] > processTicksAndRejections (node:internal/process/task_queues:96)

Issue taking money when buying furniture.

ps-housing:server:buyFurniture

if price > PlayerData.money.bank then
    Player.Functions.RemoveMoney('bank', price, "Bought furniture")
else
    Player.Functions.RemoveMoney('cash', price, "Bought furniture")
end

Should be

if price > PlayerData.money.bank then
    Player.Functions.RemoveMoney('cash', price, "Bought furniture")
else
    Player.Functions.RemoveMoney('bank', price, "Bought furniture")
end

After deleting property self is nil

[   script:ps-housing] > ref (@ps-housing/server/sv_property.lua:436)
[   script:ps-housing] > <unknown> (@oxmysql/dist/build.js:21810)
[   script:ps-housing] > processTicksAndRejections (node:internal/process/task_queues:96)```

Nil Value

I get the following error server side: SCRIPT ERROR: @qb-multicharacter/server/main.lua:84: attempt to index a nil value (global 'hasDonePreloading') I followed the instructions in the readme to the letter and didn't skip any steps

Adding a garage to a house creates an error.

image

When addling a garage to a house through the menu, or through the database it causes this error. When their is no garage in the database it works fine. When the resource is started it causes this error when their is a garage in the database.

image

Furniture Rotation

I've placed down the furniture and left the house and re-entered, rotation didn't stick. Redid the rotation and same results.

Not sure if that this error in F8 console has to do with anything CrBrowserMain/ Uncaught (in promise) TypeError: Failed to fetch (@bl-realtor/html/index.js:4)
Screenshot 2023-07-24 234904

Housing UI does does not update after deleting a property

Repro:

  1. Realtor deletes a property in the /housing UI
  2. The UI still shows the property for the realtor (shouldn't)
  3. Realtor closes the UI and then reopens, and the property no longer shows (expected)
  4. Other players open the /housing menu and they still see the deleted properties

Error @ps-housing/server/server.lua:19: bad argument #1 to 'decode' (string expected, got table)

after player buy a house, then restart the server i got error [ script:ps-housing] SCRIPT ERROR: @ps-housing/server/server.lua:19: bad argument #1 to 'decode' (string expected, got table)
[ script:ps-housing] > ref (@ps-housing/server/server.lua:19)
[ script:ps-housing] > rawQuery (@oxmysql/dist/build.js:25045)
[ script:ps-housing] > processTicksAndRejections (node:internal/process/task_queues:96)

Second fix for (foreing key constraint)

File: ps-housing/properties.sql (if this doesn't work for you then use the other one #8)

This was fixed but it was still causing errors, here is one that is not causing an error at least on my side:

DROP table IF EXISTS properties`;

CREATE TABLE IF NOT EXISTS properties (
property_id int(11) NOT NULL AUTO_INCREMENT,
owner_citizenid varchar(50) NOT NULL,
street VARCHAR(100) NULL,
region VARCHAR(100) NULL,
description LONGTEXT NULL,
has_access JSON NULL DEFAULT (JSON_ARRAY()), -- [citizenid1, citizenid2, ...]
extra_imgs JSON NULL DEFAULT (JSON_ARRAY()),
furnitures JSON NULL DEFAULT (JSON_ARRAY()),
for_sale boolean NOT NULL DEFAULT 1,
price int(11) NOT NULL DEFAULT 0,
shell varchar(50) NOT NULL,
apartment varchar(50) NULL DEFAULT NULL, -- if NULL then it's a house
door_data JSON NULL DEFAULT NULL, -- {"x": 0.0, "y": 0.0, "z": 0.0, "h": 0.0, "length": 0.0, "width": 0.0}
garage_data JSON NULL DEFAULT NULL, -- {"x": 0.0, "y": 0.0, "z": 0.0} -- NULL if no garage
PRIMARY KEY (property_id),
CONSTRAINT FK_owner_citizenid FOREIGN KEY (owner_citizenid) REFERENCES players (citizenid) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT UQ_owner_apartment UNIQUE (owner_citizenid, apartment) -- A character can only own one apartment
) ENGINE=InnoDB AUTO_INCREMENT=1;`

Garage location does not update after moving

Repro steps:

  1. As realtor go into /housing, Move Garage
  2. Place the garage at different coordinates, E to confirm
  3. Close the housing menu
  4. Actual: For the player who owns the property, the garage remains where it was previously.
  5. Expected: Garage coords should be in the new updated spot

Once you restart qb-garages and ps-housing then the garage location moves to the new coords

Error occured on exports GetProperty and GetProperties

I'm creating a custom real estate job. Try to get a property details using local getProperty = exports['ps-housing']:GetProperty(property_id) . However the error occured as below. Please advise

Error running call reference function for resource ps-housing: citizen:/scripting/lua/scheduler.lua:520: type <userdata> cannot be msgpack'd stack traceback: [C]: in function 'msgpack.pack' citizen:/scripting/lua/scheduler.lua:520: in function <citizen:/scripting/lua/scheduler.lua:482> MainThrd/ ^1SCRIPT ERROR: @addz_realestatev2/client/client.lua:409: MainThrd/ ^5 An error occurred while calling exportGetPropertyin resourceps-housing:

Shell flooded with water

If I created house near water sources e.g river, pool, the water is entered the house and I swim inside the house.

image

[BUG] Removing owned furniture will cause table indexing issue

When removing furniture from the existing furniture list setting table key nil will cause problems. Table would need to be sorted after removing the furniture. DB json from furniture after removing owned furniture.

[
  {
    "label": "Old chair",
    "object": "prop_ld_farm_chair01",
    "position": { "x": -3.6913, "y": -0.3834, "z": -0.8096 },
    "rotation": { "x": 0.0, "y": -0.0, "z": 0.0 },
    "id": "967934118"
  },
  null,
  null,
  {
    "label": "Dining Table",
    "object": "v_res_fh_diningtable",
    "position": { "x": 3.8983, "y": -1.6363, "z": -1.9493 },
    "rotation": { "x": 0.0, "y": -0.0, "z": -101.99999237060549 },
    "id": "261757118"
  }
]

https://github.com/Project-Sloth/ps-housing/blob/7a5a00b683ca056b7fe8b256847bad1008c4b96a/server/sv_property.lua#L650C39-L650C39

When placing down furniture, occasionally, it will disappear

I don't have precise reproduction steps, because I don't know how to reproduce it, but I do have errors, which will help in seeing what the issue could be.

Here is a clip of this issue occurring: https://medal.tv/games/gta-v/clips/1mRqhWF02Yr581/d1337EW9o4Mr?invite=cr-MSxMUkwsNzIwNTc3NzYs

Here are the produced errors:

 ^1SCRIPT ERROR: @ps-housing/client/cl_property.lua:570: attempt to index a nil value (field '?')^7
 ^3> findFurnitureDifference^7 (^5@ps-housing/client/cl_property.lua^7:570)
 ^3> UpdateFurnitures^7 (^5@ps-housing/client/cl_property.lua^7:601)
 ^3> handler^7 (^5@ps-housing/client/cl_property.lua^7:727)

Side note: Extremely commonly, when purchasing furniture, it doesn't even get this far, it just errors out on the UI side, and doesn't save anything. I don't have reliable reproduction here, but it is very common. Here are those errors:

error during NUI callback addToCart: @ps-housing/client/modeler.lua:373: attempt to index a nil value (local 'data')
Uncaught (in promise) TypeError: Failed to fetch (@ps-housing/html/index.js:1)

hi im trying to make a house

hello im tying to make house
job: Realtor
im tying to press e on de house creator
.
image:
image
i just installed it
[sorry for bad engish. im form the netherlands]

"GetProperties" is erroring on the latest update

Anywhere "GetProperties" or "Property.Get" is run, the system errors.

InitialiseProperties^7 (^5@ps-housing/client/client.lua^7:30)
handler^7 (^5@ps-housing/client/client.lua^7:39)
Error running call reference function for resource ps-housing: citizen:/scripting/lua/scheduler.lua:520: type <userdata> cannot be msgpack'd
stack traceback:
	[C]: in function 'msgpack.pack'
	citizen:/scripting/lua/scheduler.lua:520: in function <citizen:/scripting/lua/scheduler.lua:482>
	[C]: in field 'CreateThreadNow'
	citizen:/scripting/lua/scheduler.lua:198: in function <citizen:/scripting/lua/scheduler.lua:148>
^1SCRIPT ERROR: @bl-realtor/client/sync.lua:5: 
^5 An error occurred while calling export `GetProperties` in resource `ps-housing`:

Spawning from qb-spawn do not zoom in to property!

I do have a problem with qb-spawn since i start using ps-housing. When i choose spawn in house the cam in qb-spawn do not zoom in to the house. Is it more that have it like that or is there a fix for its ?

problem on this

[ script:ps-housing] SCRIPT ERROR: @ps-housing/server/sv_property.lua:20: attempt to call a nil value (field 'RegisterInventory')
[ script:ps-housing] > new (@ps-housing/server/sv_property.lua:20)
[ script:ps-housing] > handler (@ps-housing/server/server.lua:80)
[ script:ps-housing] > (@oxmysql/dist/build.js:21810)
[ script:ps-housing] > processTicksAndRejections (node:internal/process/task_queues:96)

any help please i used lj-inventory and last coret
his error happens when i click to create the house
and create on table the house on properties

regards

Nil value error

[ 1740469] [b2802_GTAProce] MainThrd/ error during NUI callback select: citizen:/scripting/lua/scheduler.lua:739: ^1SCRIPT ERROR: @ps-housing/client/cl_property.lua:524: attempt to concatenate a nil value (field 'street')

This error occurs when attempting to leave an apartment

Script error

Hi. i think i did everything right. but i am getting an error.,

@ps-housing/server/server.lua:1: No such export GetCoreObject in resource qb-core

any ideas?

Still cannot select shell

I've just downloaded the newest release of ps-housing and replaced my version on my server. The shells are still not showing up (see img1)
img1
I've included F8 console errors also
img2
@MonkeyWhisper Please do not just close the issue without giving me a chance to reply. I am not an idiot and telling me to ensure in the right order was not the solution to the previous issue #63 because I did that before I posted. And I restarted several times and did everything the install requires. Please advise, then give me a chance to respond and confirm that it works before you close the issue.

Also, the script worked 2 days ago, then stopped working yesterday. Without me doing anything but play around in the city using the script. No config changes, no changes to any of the lua files, nothing. Except changing the ensure order in the cfg file...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.