Usage
nn_interaction Documentation
A comprehensive interaction system for FiveM resources that provides targeting and text display functionality for entities, models, coordinates, and global objects.
Table of Contents
Installation
Configuration
Data Structure
API Reference
Local Entity Interactions
Model Interactions
Global Interactions
Coordinate Interactions
Utility Functions
Examples
Advanced Usage
Installation
Place the
nn_interactionresource in your resources folderAdd
ensure nn_interactionto your server.cfgConfigure the settings in
config.luaif needed
Configuration
The script uses config.lua for default settings:
Data Structure
All interaction functions use a similar data structure:
API Reference
Local Entity Interactions
These functions work with specific entity IDs.
addInteractionLocalEntity(name, entity, data, resource)
Adds an interaction to a specific local entity.
Parameters:
name(string): Unique interaction nameentity(number|table): Entity ID or table of entity IDsdata(table): Interaction data structureresource(string, optional): Resource name (auto-detected if not provided)
addTextLocalEntity(name, entity, data, resource)
Adds text display to a specific local entity.
removeLocalEntity(entity, name, option, resource)
Removes interactions from local entities.
Parameters:
entity(number|table): Entity ID(s) to remove fromname(string, optional): Specific interaction name to removeoption(string, optional): Specific option to removeresource(string, optional): Resource name
hideLocalEntity(entity, name)
Temporarily hides interactions on local entities.
showLocalEntity(entity, name)
Shows previously hidden interactions on local entities.
Model Interactions
These functions work with entity model hashes and apply to all entities of that model.
addInteractionModel(name, model, data, resource)
Adds interactions to all entities of a specific model.
Parameters:
name(string): Unique interaction namemodel(number|table): Model hash or table of model hashesdata(table): Interaction data structureresource(string, optional): Resource name
addTextModel(name, model, data, resource)
Adds text display to all entities of a specific model.
removeModel(model, name, option, resource)
Removes interactions from model-based interactions.
hideModel(model, name)
Temporarily hides interactions on model-based interactions.
showModel(model, name)
Shows previously hidden model-based interactions.
Global Interactions
These functions work with entity types (ped, vehicle, player, object).
addInteractionGlobal(name, entityType, data, resource)
Adds interactions to all entities of a specific type.
Parameters:
name(string): Unique interaction nameentityType(string|table): Entity type ("ped", "vehicle", "player", "object")data(table): Interaction data structureresource(string, optional): Resource name
addTextGlobal(name, entityType, data, resource)
Adds text display to all entities of a specific type.
removeGlobal(entityType, name, option, resource)
Removes global interactions.
hideGlobal(entityType, name)
Temporarily hides global interactions.
showGlobal(entityType, name)
Shows previously hidden global interactions.
Coordinate Interactions
These functions create interactions at specific world coordinates.
addInteractionCoords(name, coords, data, resource)
Adds interaction at specific coordinates.
Parameters:
name(string): Unique interaction namecoords(vector3|table): Coordinates or table of coordinatesdata(table): Interaction data structureresource(string, optional): Resource name
addTextCoords(name, coords, data, resource)
Adds text display at specific coordinates.
removeCoords(coords, name, option, resource)
Removes coordinate-based interactions.
hideCoords(coords, name)
Temporarily hides coordinate interactions.
showCoords(coords, name)
Shows previously hidden coordinate interactions.
Utility Functions
removeResource(resource)
Removes all interactions created by a specific resource.
Examples
Basic Entity Interaction
Model-Based Interactions
Global Interactions
Coordinate-Based Interactions
Text-Only Display
Advanced Vehicle Bone Targeting
Multiple Options with Conditions
Advanced Usage
Dynamic Interaction Management
Resource Cleanup
Performance Considerations
Use
checkVisibility = truefor entities that might be behind wallsSet appropriate
distancevalues to avoid unnecessary processingUse
hideSquare = truefor text-only displaysClean up unused interactions to maintain performance
Use model-based interactions instead of multiple entity-specific ones when possible
Error Handling
The script includes built-in error handling and will log warnings for:
Invalid entity IDs
Incorrect parameter types
Non-existent interactions during removal
Missing required parameters
Enable debug mode in config.lua to see detailed logging:
Last updated