You can override interact actions from no-base/configure/client/interact.lua
AddEventHandler("no-base:interact:qb", function(response)
TriggerEvent(response.data.event, response.data.parameters, response.entity)
end)
Config.Interact = {
AddEntryByModel = function(models, entries, options)
local function canInteract(entity)
return not options.isEnabled or options.isEnabled(entity)
end
local _entries = {}
for _, entry in pairs(entries) do
_entries[#_entries + 1] = {
icon = "fas fa-" .. entry.icon,
label = entry.label,
event = "no-base:interact:qb",
data = {event = entry.event, parameters = entry.parameters},
distance = options.distance?.radius,
bones = options.bone and {options.bone} or options.bones,
canInteract = canInteract
}
end
local resource = GetInvokingResource()
local handler
handler = AddEventHandler("onResourceStop", function(resName)
if resName ~= resource then return end
RemoveEventHandler(handler)
local labels = {}
for _, entry in pairs(_entries) do
labels[#labels + 1] = entry.label
end
exports["qb-target"]:RemoveTargetModel(models, labels)
end)
return exports["qb-target"]:AddTargetModel(models, {
options = _entries,
distance = options.distance?.radius
})
end,
AddEntryBySphereZone = function(coords, radius, entries, options)
local zoneId = entries[1] and entries[1].id
if not zoneId then return end
local function canInteract(entity)
return not options.isEnabled or options.isEnabled(entity)
end
local _entries = {}
for _, entry in pairs(entries) do
_entries[#_entries + 1] = {
icon = "fas fa-" .. entry.icon,
label = entry.label,
event = "no-base:interact:qb",
data = {event = entry.event, parameters = entry.parameters},
distance = options.distance?.radius,
bones = options.bone and {options.bone} or options.bones,
canInteract = canInteract
}
end
exports["qb-target"]:AddCircleZone(zoneId, coords, radius, {
name = zoneId,
useZ = true
}, {
options = _entries,
distance = options.distance?.radius
})
local resource = GetInvokingResource()
local handler
handler = AddEventHandler("onResourceStop", function(resName)
if resName ~= resource then return end
RemoveEventHandler(handler)
exports["qb-target"]:RemoveZone(zoneId)
end)
end
}
AddEntryByModel
Adds interaction to passed models.
Parameters
AddEntryBySphereZone
Adds interaction for sphere zone.
Parameters