🎉 Driving School is released. Read more →
Paid Scripts
Housing
Integrations
Other Scripts
Crm Multichar

CRM Multicharacter

function crm_load_house_data(crm_source)
    local crm_house_garages = {}
    local crm_houses = {}
    local Player = crm_core.crm_shared.crm_framework.Functions.GetPlayer(crm_source)
    local houses = exports.bcs_housing:GetOwnedHomeKeys(Player.PlayerData.citizenid)
    if houses[1] ~= nil then
        for _, home in pairs(houses) do
            local owned = false
            if tonumber(home.owner) == 1 then
                owned = true
            end
            local garage = home.configuration.garage ~= nil and home.data.garage or {}
            crm_houses[home.identifier] = {
                coords = home.complex ~= 'Flat' and home.entry or home.data.flat.coords,
                owned = home.owner,
                price = home.price,
                locked = true,
                adress = home.name,
                tier = home.type,
                garage = garage,
                decorations = {},
            }
            crm_house_garages[home.identifier] = {
                label = home.name,
                takeVehicle = garage,
            }
        end
    end
    TriggerClientEvent("qb-garages:client:houseGarageConfig", -1, crm_house_garages)
    TriggerClientEvent("qb-houses:client:setHouseConfig", -1, crm_houses)
end