> For the complete documentation index, see [llms.txt](https://docs.otherplanet.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.otherplanet.dev/scripts/op-garages-v2/script-integrations/qs-housing.md).

# qs-housing

Integration for OP-GARAGES with qs-housing

{% hint style="warning" %}
IMPORTANT: This integration works only above Version 2.5.0 of OP Garages Script&#x20;
{% endhint %}

{% stepper %}
{% step %}

### Find Client-side Garages Files

Go to: `qs-housing/client/custom/garages/`
{% endstep %}

{% step %}

### Create File

Create file inside directory named: `op-garages.lua`
{% endstep %}

{% step %}

### Paste Code

Paste code inside the created file:

```lua
--[[
    In this section you will find the configuration of the garage that you have selected, in
    case your system is not found here, you can ask the creator of your garage to add its exports
    in any of these files, or use these files to create your own, that would help our community!
]]

if Config.Garage ~= 'op-garages' then
    return
end

function TriggerHouseUpdateGarage() end

function StoreVehicle(house)
    local ped = PlayerPedId()
    local pos = GetEntityCoords(ped)
    local heading = GetEntityHeading(ped)

    local coords = vec4(pos.x, pos.y, pos.z, heading)
    exports['op-garages']:OpenGarageHere(coords, true)
end

function OpenGarage(house)
    local ped = PlayerPedId()
    local pos = GetEntityCoords(ped)
    local heading = GetEntityHeading(ped)

    local coords = vec4(pos.x, pos.y, pos.z, heading)
    exports['op-garages']:OpenGarageHere(coords, true)
end

CreateThread(function()
    while true do
        Wait(0)
        local ped = PlayerPedId()
        local pos = GetEntityCoords(ped)

        if CurrentHouse ~= nil and (CurrentHouseData.haskey or not Config.Houses[CurrentHouse].locked) and Config.Houses and Config.Houses[CurrentHouse] and Config.Houses[CurrentHouse].garage then
            local dist = GetDistanceBetweenCoords(pos, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z, true)

            if dist < 5.0 then
                DrawMarker(20, Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)

                if dist < 2.0 then
                    local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
                    if Config.Houses[CurrentHouse].garage and Config.Houses[CurrentHouse].garage.x and Config.Houses[CurrentHouse].garage.y and Config.Houses[CurrentHouse].garage.z then
                        if vehicle and vehicle ~= 0 then
                            DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage1', 'E')

                            if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
                                if not StoreVehicle then return print('Your client/custom/garages/*.lua is not correctly configured') end
                                StoreVehicle(CurrentHouse)
                            end
                        else
                            DrawText3D(Config.Houses[CurrentHouse].garage.x, Config.Houses[CurrentHouse].garage.y, Config.Houses[CurrentHouse].garage.z + 0.3, 'Store', 'open_garage2', 'E')
                            if IsControlJustPressed(0, Keys['E']) or IsDisabledControlJustPressed(0, Keys['E']) then
                                if not OpenGarage then return print('Your client/custom/garages/*.lua is not correctly configured') end
                                OpenGarage(CurrentHouse)
                            end
                        end
                    end
                end
            else
                Wait(1000)
            end
        end
    end
end)

```

{% endstep %}

{% step %}

### Find Server-side Garages Files

Go to: `qs-housing/server/custom/garages/`
{% endstep %}

{% step %}

### Create File

Create file named: `op-garages.lua`

And paste this code inside:

```lua
if Config.Garage ~= 'op-garages' then
    return
end

function TriggerAddHouseGarage(house, garageInfo)
    return
end

function TriggerHouseUpdateGarage(garages)
    return
end

function TriggerHouseRemoveGarage(house)
    return
end

```

{% endstep %}

{% step %}

### Go to config.lua

Go to the main config file and find Config.Garage

Replace this:

```lua
local garages                          = { -- [CORE] Resource name → internal alias
    ['qb-garages']         = 'qb-garages',
    ['qs-advancedgarages'] = 'qs-advancedgarages',
    ['jg-advancedgarages'] = 'jg-advancedgarages',
    ['cd_garage']          = 'cd_garage',
    ['okokGarage']         = 'okokGarage',
    ['loaf_garage']        = 'loaf_garage',
    ['rcore_garage']       = 'rcore_garage',
    ['zerio-garage']       = 'zerio-garage',
    ['codem-garage']       = 'codem-garage',
    ['ak47_garage']        = 'ak47_garage',
    ['ak47_qb_garage']     = 'ak47_qb_garage',
    ['vms_garagesv2']      = 'vms_garagesv2',
    ['cs-garages']         = 'cs-garages',
    ['msk_garage']         = 'msk_garage',
    ['RxGarages']          = 'RxGarages',
    ['ws_garage-v2']       = 'ws_garage-v2',
}
Config.Garage                          = dependencyCheck(garages) or 'standalone' -- [AUTO]
```

With this:

```lua
local garages                          = { -- [CORE] Resource name → internal alias
    ['qb-garages']         = 'qb-garages',
    ['qs-advancedgarages'] = 'qs-advancedgarages',
    ['jg-advancedgarages'] = 'jg-advancedgarages',
    ['cd_garage']          = 'cd_garage',
    ['okokGarage']         = 'okokGarage',
    ['loaf_garage']        = 'loaf_garage',
    ['rcore_garage']       = 'rcore_garage',
    ['zerio-garage']       = 'zerio-garage',
    ['codem-garage']       = 'codem-garage',
    ['ak47_garage']        = 'ak47_garage',
    ['ak47_qb_garage']     = 'ak47_qb_garage',
    ['vms_garagesv2']      = 'vms_garagesv2',
    ['cs-garages']         = 'cs-garages',
    ['msk_garage']         = 'msk_garage',
    ['RxGarages']          = 'RxGarages',
    ['ws_garage-v2']       = 'ws_garage-v2',
    ['op-garages']       = 'op-garages',
}
Config.Garage                          = dependencyCheck(garages) or 'standalone' -- [AUTO]
```

{% endstep %}

{% step %}

### All Done!

Integration is ready!
{% endstep %}
{% endstepper %}
