🎉 Driving School is released. Read more →
Paid Scripts
Housing
Integrations
Spawn Selector Scripts
Jerzys Spawn

Jerzys Spawn Selector

Client

Add local Houses = {} to the top of the file

client/client.lua
    coreName.Functions.TriggerCallback('qb-spawn:server:getOwnedApartments', function(houses, apartments)
        local myHouses = {}
        for _, data in pairs(houses) do
            if data then
                Houses[data.identifier] = data
                myHouses[#myHouses + 1] = {
                    name = data.identifier,
                    label = data.name,
                    type = data.type
                }
            end
        end
        SendNUIMessage({
            action = 'open',
            getCoords = getData,
            title = Config.welcomeTitle,
            description = Config.welcomeDesc,
            accentColor = Config.accentColor,
            succesColor = Config.successColor,
            errorColor = Config.errorColor,
            language = Config.JSlanguage,
            apartments = apartments,
            houses = myHouses,
            god = getData.isAdmin
        })
    end)
client/client.lua
RegisterNUICallback('spawnHouse', function(data, cb)
    local location = data.apartment
    beforePlayer()
    if Houses[location].type ~= 'mlo' then
        TriggerEvent('Housing:client:EnterHome', location)
    else
        SetEntityCoords(PlayerPedId(), Houses[location].entry.x, Houses[location].entry.y, Houses[location].entry.z)
    end
    TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
    TriggerEvent('QBCore:Client:OnPlayerLoaded')
    TriggerServerEvent('qs-housing:server:SetInsideMeta', 0, false)
    TriggerServerEvent('qb-apartments:server:SetInsideMeta', 0, 0, false)
    showUi(false)
    screenFadeIn()
    -- TriggerEvent("backitems:start")
    cb('ok')
end)

Server

Find qb-spawn:server:getOwnedApartments and replace the line with local houses with

server/server.lua
    local houses = exports['bcs_housing']:GetOwnedHomeKeys(cid)