Client Exports
All exports are available on the client via exports.sleepless_interact.
addCoords
Adds static coordinate-based interactions at specific locations that players can interact with when within range.
local id = exports.sleepless_interact:addCoords(coords, options)Parameters
| Parameter | Type | Description |
|---|---|---|
coords | vector3 | vector3[] | Single coordinate or array of coordinates |
options | Option | Option[] | Single option or array of interaction options |
Returns
| Type | Description |
|---|---|
string | The unique identifier for the added coordinate interaction |
Example
-- Single coordinate
local id = exports.sleepless_interact:addCoords(vec3(100.0, 200.0, 30.0), {
label = "Interact Here",
icon = "hand",
distance = 2.0,
onSelect = function(data) print("Selected!") end,
canInteract = function(entity, distance, coords, name)
return distance < 2.0
end
})
-- Multiple coordinates
local id = exports.sleepless_interact:addCoords({
vec3(100.0, 200.0, 30.0),
vec3(150.0, 250.0, 30.0)
}, {
label = "Interact Here",
onSelect = function(data) print("Multi-point interaction") end
})When using multiple coordinates, each option maintains the same ID but is tracked separately in the system.
removeCoords
Removes coordinate-based interactions from the game.
exports.sleepless_interact:removeCoords(id, options?, suppressWarning?)Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The coordinate ID to remove |
options | string | string[]? | Specific option names to remove (optional — omit to remove all) |
suppressWarning | boolean? | Suppress warning if ID doesn't exist |
Example
local id = exports.sleepless_interact:addCoords(vec3(100.0, 200.0, 30.0), {
label = "Interact Here",
icon = "hand",
distance = 2.0,
onSelect = function(data) print("Selected!") end,
})
-- Remove specific options by name
exports.sleepless_interact:removeCoords(id, { "option1" })
-- Remove all options for this coordinate
exports.sleepless_interact:removeCoords(id)addLocalEntity
Adds interaction options for specific non-networked local entities.
exports.sleepless_interact:addLocalEntity(arr, options)Parameters
| Parameter | Type | Description |
|---|---|---|
arr | number | number[] | Entity ID or array of entity IDs |
options | Option | Option[] | Single option or array of options |
Example
exports.sleepless_interact:addLocalEntity(entityId, {
label = "Local Interaction",
name = "local_interaction",
onSelect = function(data) print("Local entity interaction") end
})removeLocalEntity
Removes interaction options from non-networked local entities.
exports.sleepless_interact:removeLocalEntity(arr, options?)Parameters
| Parameter | Type | Description |
|---|---|---|
arr | number | number[] | Entity ID or array of entity IDs |
options | string | string[]? | Option name(s) to remove (optional — omit to remove all) |
Example
-- Remove specific options by name
exports.sleepless_interact:removeLocalEntity(entityId, "local_interaction")
-- Remove all options from the entity
exports.sleepless_interact:removeLocalEntity(entityId)addEntity
Adds interaction options for specific networked entities.
exports.sleepless_interact:addEntity(arr, options)Parameters
| Parameter | Type | Description |
|---|---|---|
arr | number | number[] | Network ID or array of network IDs |
options | Option | Option[] | Single option or array of options |
Example
local NetId = NetworkGetNetworkIdFromEntity(entity)
exports.sleepless_interact:addEntity(NetId, {
label = "Networked Interaction",
name = "networked_interaction",
onSelect = function(data) print("Network entity interaction") end
})removeEntity
Removes interaction options from networked entities.
exports.sleepless_interact:removeEntity(arr, options?)Parameters
| Parameter | Type | Description |
|---|---|---|
arr | number | number[] | Network ID or array of network IDs |
options | string | string[]? | Option name(s) to remove (optional — omit to remove all) |
Example
local NetId = NetworkGetNetworkIdFromEntity(entity)
-- Remove specific options by name
exports.sleepless_interact:removeEntity(NetId, "networked_interaction")
-- Remove all options from the entity
exports.sleepless_interact:removeEntity(NetId)addModel
Adds interaction options for specific entity models. Any entity matching the model will have these options.
exports.sleepless_interact:addModel(arr, options)Parameters
| Parameter | Type | Description |
|---|---|---|
arr | number | string | (number | string)[] | Model hash/name or array of models |
options | Option | Option[] | Single option or array of options |
Example
exports.sleepless_interact:addModel("prop_boxpile_01a", {
label = "Interact with Box",
name = "box_interact",
onSelect = function(data) print("Box interaction") end
})removeModel
Removes interaction options from specific models.
exports.sleepless_interact:removeModel(arr, options?)Parameters
| Parameter | Type | Description |
|---|---|---|
arr | number | string | (number | string)[] | Model hash/name or array of models |
options | string | string[]? | Option name(s) to remove (optional — omit to remove all) |
Example
-- Remove specific options by name
exports.sleepless_interact:removeModel("prop_boxpile_01a", "box_interact")
-- Remove all options for this model
exports.sleepless_interact:removeModel("prop_boxpile_01a")addGlobalObject
Adds interaction options globally for all objects in the world.
exports.sleepless_interact:addGlobalObject(options)Parameters
| Parameter | Type | Description |
|---|---|---|
options | Option | Option[] | Single option or array of options |
Example
exports.sleepless_interact:addGlobalObject({
label = "Pickup Object",
name = "pickup_object",
icon = "box",
onSelect = function(data) print("Picking up object") end
})removeGlobalObject
Removes global object interaction options.
exports.sleepless_interact:removeGlobalObject(options)Parameters
| Parameter | Type | Description |
|---|---|---|
options | string | string[] | Option name(s) to remove |
Example
exports.sleepless_interact:removeGlobalObject("pickup_object")addGlobalPlayer
Adds interaction options globally for all players.
exports.sleepless_interact:addGlobalPlayer(options)Parameters
| Parameter | Type | Description |
|---|---|---|
options | Option | Option[] | Single option or array of options |
Example
exports.sleepless_interact:addGlobalPlayer({
label = "Trade",
name = "player_trade",
icon = "exchange",
onSelect = function(data) print("Trading with player") end
})removeGlobalPlayer
Removes global player interaction options.
exports.sleepless_interact:removeGlobalPlayer(options)Parameters
| Parameter | Type | Description |
|---|---|---|
options | string | string[] | Option name(s) to remove |
Example
exports.sleepless_interact:removeGlobalPlayer("player_trade")addGlobalPed
Adds interaction options globally for all peds.
exports.sleepless_interact:addGlobalPed(options)Parameters
| Parameter | Type | Description |
|---|---|---|
options | Option | Option[] | Single option or array of options |
Example
exports.sleepless_interact:addGlobalPed({
label = "Talk to Ped",
name = "talk_to_ped",
icon = "comment",
onSelect = function(data) print("Talking to ped") end
})removeGlobalPed
Removes global ped interaction options.
exports.sleepless_interact:removeGlobalPed(options)Parameters
| Parameter | Type | Description |
|---|---|---|
options | string | string[] | Option name(s) to remove |
Example
exports.sleepless_interact:removeGlobalPed("talk_to_ped")addGlobalVehicle
Adds interaction options globally for all vehicles.
exports.sleepless_interact:addGlobalVehicle(options)Parameters
| Parameter | Type | Description |
|---|---|---|
options | Option | Option[] | Single option or array of options |
Example
exports.sleepless_interact:addGlobalVehicle({
label = "Enter Vehicle",
name = "enter_vehicle",
icon = "car",
onSelect = function(data) print("Entering vehicle") end
})removeGlobalVehicle
Removes global vehicle interaction options.
exports.sleepless_interact:removeGlobalVehicle(options)Parameters
| Parameter | Type | Description |
|---|---|---|
options | string | string[] | Option name(s) to remove |
Example
exports.sleepless_interact:removeGlobalVehicle("enter_vehicle")disableInteract
Disables or enables the entire interaction system and clears nearby/current options.
exports.sleepless_interact:disableInteract(state)Parameters
| Parameter | Type | Description |
|---|---|---|
state | boolean | true to disable interactions, false to enable them |
Example
-- Disable interactions (e.g., during a cutscene)
exports.sleepless_interact:disableInteract(true)
-- Re-enable interactions
exports.sleepless_interact:disableInteract(false)