Overview
local groupKey = exports['nv-interactions']:AddInteraction(data, options, details)
Return Value
| Name | Type | Description | |
|---|---|---|---|
| groupKey | string | false | Unique identifier for the interaction group. Returns false on failure. |
Parameters
data
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Display name in menu |
| key | string | Yes | Keyboard key |
| type | string | Yes | coord, entity, 3dtext |
options
| Field | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Option label |
| icon | string | No | FontAwesome icon |
| distance | number | Yes | Interaction distance |
| dotdistance | number | No | Dot visibility distance |
| disabled | boolean | No | Disable option |
| onselected | function | No | Callback |
| event | string | No | Client event |
details
| Type | Description |
|---|---|
| vector3 | Single coordinate |
| vector3[] | Multiple coordinates |
| number | Entity id |
Interaction State Management
Disable Interaction
exports['nv-interactions']:DisableInteraction('coord', groupKey)
Enable Interaction
exports['nv-interactions']:EnableInteraction('coord', groupKey)
Edit Interaction
exports['nv-interactions']:EditInteraction('coord', groupKey, {
name = 'Updated Interaction',
key = 'F',
})
Examples
Single Coordinate
exports['nv-interactions']:AddInteraction({
name = 'Test Interaction',
key = 'E',
type = 'coord',
}, {
{
text = 'Test Option',
distance = 2.0,
onselected = function()
print('Selected')
end
}
}, vec(1.0, 1.0, 1.0))
Multiple Coordinates
exports['nv-interactions']:AddInteraction({
name = 'Multiple Locations',
key = 'E',
type = 'coord',
}, {
{
text = 'Interact',
distance = 2.0,
}
}, {
vec(1.0,1.0,1.0),
vec(2.0,2.0,2.0)
})
Entity Interaction
exports['nv-interactions']:AddInteraction({
name = 'Entity Interaction',
key = 'E',
type = 'entity',
}, {
{
text = 'Talk',
distance = 2.0,
}
}, entityId)
3D Text Interaction
exports['nv-interactions']:AddInteraction({
name = '3D Text',
type = '3dtext',
}, {
{
text = 'Read',
distance = 2.0,
}
}, vec(10.0,10.0,10.0))

