Functions
Exports to use to add or remove interactions.
AddInteractionEntity
The AddInteractionEntity
function allows you to add a single interaction point to a specific entity, such as a npc (ped
), object (object
), or vehicle (vehicle
). This is useful for scenarios where you want to associate specific actions with a particular entity.
Syntax
Options
entity
: The entity to which the interaction is being added. It can be a npc (ped
), object (object
), or vehicle (vehicle
).
Interaction Configuration
distance (optional)
: The maximum distance at which the interaction is possible.offset (optional):
Adjust the positions of the interaction label and target.checkVisibility (optional)
: A boolean determining if the interaction should only be available when the coordinates are visible.
Interaction Options
Each option in the interaction table is itself a table with several key-value pairs:
name
: A unique identifier for the interaction option. This is used to refer to the specific interaction later if needed, like for removing it.icon
: An icon representing the interaction, specified using FontAwesome icons. Make sure to use icons from the FontAwesome Free collection.label
: The text label that will be displayed for this interaction option.key
: The keyboard key that the player needs to press to activate this interaction (e.g., "E").duration
: The duration in milliseconds that the key needs to be pressed.action
: A function that defines what will happen when the interaction is activated.
Example Usage
AddInteractionEntityMultiple
The AddInteractionEntityMultiple
function is designed to add multiple interaction points to a single entity, allowing for different interactions at different locations or contexts.
Syntax
Options
entity
: The entity to which the interactions are being added.
Interaction Configuration
An array of interaction configurations, each containing:
distance (optional)
: The maximum distance at which the interaction is possible.checkVisibility (optional)
: A boolean determining if the interaction should only be available when the coordinates are visible.
Individual Interactions
An array of individual interactions, each with its settings:
offset
: Positions for the label and target of the interaction.name
: Unique identifier for the interaction.icon
: Icon representing the interaction, using FontAwesome.label
: Text displayed for the interaction.key
: Keyboard key to activate the interaction.duration
: How long the key needs to be pressed.action
: Function executed upon interaction.
Example Usage
AddInteractionCoords
The AddInteractionCoords
function allows you to add a single interaction point to specific coordinates. This is useful for scenarios where you want to associate specific actions with a particular location in the game.
Syntax
Options
coords
: The coordinates where the interaction is being added. These should be provided as avector3(x, y, z)
.
Interaction Configuration:
distance (optional):
The maximum distance at which the interaction is possible.offset (optional):
Adjust the positions of the interaction label and target.checkVisibility (optional)
: A boolean determining if the interaction should only be available when the coordinates are visible.
Interaction Options:
Each option within the interaction array is itself an object with several key-value pairs:
name
: A unique identifier for the interaction option. This is used to refer to the specific interaction later if needed, like for removing it.icon
: An icon representing the interaction, specified using FontAwesome icons. Ensure you use icons from the FontAwesome Free collection.label
: The text label that will be displayed for this interaction option.key
: The keyboard key that the player needs to press to activate this interaction (e.g., "E").duration
: The duration in milliseconds that the key needs to be pressed.action
: A function that defines what will happen when the interaction is activated.
Example Usage
RemoveInteraction
The RemoveInteraction
function is used to remove interactions from a specific entity.
Options
entity
: The entity from which you are removing the interaction(s).interactionName
(optional): The name of the specific interaction to remove. This is the same name you assigned when creating the interaction.
Example Usage
AddInteractionEntity, AddInteractionEntityMultiple
AddInteractionCoords
Last updated