NoneM
Tebex
  • Resources
    • no-base
      • Supported Resources
      • Configuration
        • Player
          • Controls
          • Actions
        • Inventory
        • Interact (Target)
        • Alerts
          • Notification
          • Indicators
    • no-alerts
      • Exports & Events
      • Notification Usage
      • Indicator Usage
    • no-chains
      • Configuration
      • Exports & Events
    • no-contextmenu
      • Exports
      • Contextmenu Usage
      • Input Menu Usage
    • no-elevators
      • Configuration
        • Elevator Creator
        • Scene Creator
        • Floor Creator
        • Door Selector
        • Icons
      • Restrictions
        • Elevator Restriction
        • Floor Restriction
    • no-gameplaycam
      • Configuration
      • Exports & Events
    • no-housing
      • Configuration
        • Buildings
          • Adding IPL Building
          • Adding Shell Building
          • Adding Building Interaction
        • Real Estate
        • Commands
        • Furniture Interactions
        • Garage
      • House Editor
        • Creating Houses
        • Editing & Removing Existing Houses
      • Furniture Editor
        • Editing Furnitures
        • Editing Furniture Categories
      • Access Sharing
      • Exports & Events
    • no-mop
      • Configuration
        • Client
        • How to disable pollution for interiors?
        • Use with commands
      • Exports & Events
    • no-newspaper
      • Configuration
        • Registering Papers
      • Exports & Events
    • no-payphone
      • Configuration
      • Integration
        • VOIP Integration
        • Phone Integration
    • no-polaroid
      • Configuration
      • Exports & Events
    • no-rappel
      • Configuration
      • Exports & Events
    • no-spy
      • Configuration
        • Client
        • Commands
      • Exports & Events
    • no-torture
      • Configuration
      • Exports & Events
    • no-trains
      • Configuration
      • Exports & Events
    • no-vehicles
      • Configuration
        • Anchor
        • Cruise
        • Indicator
        • Roll
        • Seat Belt
        • Siren Lights
        • Siren Sounds
      • Exports & Events
Powered by GitBook
On this page
  • What is building interactions?
  • Examples
  1. Resources
  2. no-housing
  3. Configuration
  4. Buildings

Adding Building Interaction

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

What is building interactions?


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

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.

To be able to add interaction to the building, you need to add interactions to the building data.

Examples


no-housing/config/shared/buildings/ipl/meth.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
}
PreviousAdding Shell BuildingNextReal Estate

Last updated 1 year ago