Exports
Interaction System Documentation
This script allows developers to add interaction options based on coordinates, entities, models, and vehicles in FiveM. Interactions are registered globally, locally, or to specific entities, peds, or vehicles, and they can also be removed dynamically.
Functions
addCoords
addCoords
Adds interaction options based on specific coordinates. If the coordinates are close to an already registered option, the new options are added to the existing interaction.
Parameters:
data: A table containing the following:
coords
: The vector coordinates where the interaction occurs.distance
: (optional) The maximum distance the interaction can be triggered (default: 2).options
: A table of interaction options.
Usage:
Example:
addLocalEntity
addLocalEntity
Adds interaction options for a local entity. The options are tied specifically to this entity.
Parameters:
data: A table containing:
entity
: The local entity (ID).distance
: (optional) The maximum distance the interaction can be triggered (default: 2).options
: A table of interaction options.
Usage:
Example:
addEntity
addEntity
Adds interaction options for a network entity. The interaction will be attached to the network ID of the entity.
Parameters:
data: A table containing:
netId
: The network ID of the entity.distance
: (optional) The maximum distance for interaction (default: 2).options
: A table of interaction options.
Usage:
Example:
addGlobalPed
addGlobalPed
Adds interaction options for global peds (pedestrian NPCs). These options will apply to any ped in the game within the specified distance.
Parameters:
data: A table containing:
distance
: (optional) The maximum distance for interaction (default: 3).options
: A table of interaction options.
Usage:
Example:
addGlobalVehicle
addGlobalVehicle
Adds interaction options for vehicles. These interactions apply to all vehicles within the specified distance.
Parameters:
data: A table containing:
distance
: (optional) The maximum distance for interaction (default: 2).options
: A table of interaction options.
Usage:
Example:
addModel
addModel
Adds interaction options for a specific model (e.g., a vehicle or object model). Any instance of this model within the specified distance can trigger the interaction.
Parameters:
data: A table containing:
model
: The model name.distance
: (optional) The maximum distance for interaction (default: 2).options
: A table of interaction options.
Usage:
Example:
removeInteract
removeInteract
Removes an interaction option based on its unique ID. This ID is generated when an interaction is added.
Parameters:
id: The unique ID of the interaction to be removed.
Usage:
Example:
Last updated