---
description: From this section, you can learn how to add building interactions
---

# Adding Building Interaction

## What is building interactions?

***

Building interactions is functions that adds unique interactions to the building. These interactions can be anything you want.

{% hint style="info" %}
Building interactions are enabled when the player enters the building and disabled when the player leaves the building. For this reason, a function should be returned that will deactive the interaction.
{% endhint %}

{% hint style="info" %}
To be able to add interaction to the building, you need to add interactions to the building data.
{% endhint %}

## Examples

***

> `no-housing/config/shared/buildings/ipl/meth.lua`

```lua
local Interactions = {
    function(building, ctx)
        local stashCoords = {vector3(970.4816, -146.893, -49.0)}
        local zoneId = "housing:stash:static"
        local zones = {}

        for k, coords in pairs(stashCoords) do
            zones[#zones + 1] = CreateSphereZone(zoneId, {
                id = zoneId .. ":" .. k,
                coords = coords,
                radius = 1.5,
                data = k
            })
        end

        local destroyListener = UsePolyHook(zoneId, {
            label = "Stash",
            icon = "box",
            onPressed = function(stashId, stop)
                local stash = "housing:static:stash:" .. ctx.id .. ":" .. stashId
                TriggerEvent("inventory:open", stash, ctx.address)
            end
        })
    
        return function()
            destroyListener()
            for _, destroy in pairs(zones) do
                destroy()
            end
        end
    end
}

Config.Buildings.Ipl.meth = {
    interactions = Interactions,
    coords = vector3(978.6258, -144.1735, -48.99),
    doors = {
        {coords = vector3(969.4758, -147.1619, -46.40), h = 271.15}
    },
    onEnter = function(ctx)

    end,
    onExit = function()

    end
}

```
