Adding Building Interaction
From this section, you can learn how to add building interactions
What is building interactions?
Examples
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
}
Last updated