Client Side Exports
This document lists all available client-side exports for the lyre_context resource. All exports documented here are client-side only and should be called from client scripts.
Entity Options
addVehicleOption
Adds an interaction option to all vehicles in the game.
Export:
exports.lyre_context:addVehicleOption(options)Arguments:
options
table or table[]
Yes
A single option or an array of options. See Options Properties for details.
Returns:
stringornumber- The option name(s) or auto-generated ID that can be used to remove the option later.
Example:
-- Single option
local optionId = exports.lyre_context:addVehicleOption({
name = "lock_vehicle",
label = "Lock/Unlock Vehicle",
icon = "fa-solid fa-lock",
distance = 3.0,
onSelect = function(ctx)
-- ctx contains entity data
local isLocked = GetVehicleDoorLockStatus(ctx.id) == 2
SetVehicleDoorsLocked(ctx.id, isLocked and 1 or 2)
end
})
-- Multiple options at once
local optionId = exports.lyre_context:addVehicleOption({
{
name = "check_fuel",
label = "Check Fuel Level",
icon = "fa-solid fa-gas-pump",
onSelect = function(ctx)
print("Vehicle fuel: " .. GetVehicleFuelLevel(ctx.id))
end
},
{
name = "check_health",
label = "Check Engine Health",
icon = "fa-solid fa-heart",
onSelect = function(ctx)
print("Engine health: " .. GetVehicleEngineHealth(ctx.id))
end
}
})removeVehicleOption
Removes a previously added vehicle option.
Export:
exports.lyre_context:removeVehicleOption(optionName)Arguments:
optionName
string or number
Yes
The option name or ID returned by addVehicleOption.
Returns:
void
Example:
exports.lyre_context:removeVehicleOption("lock_vehicle")addPedOption
Adds an interaction option to all peds (NPCs and your own character).
Export:
exports.lyre_context:addPedOption(options)Arguments:
options
table or table[]
Yes
A single option or an array of options. See Options Properties for details.
Returns:
stringornumber- The option name(s) or auto-generated ID.
Example:
local optionId = exports.lyre_context:addPedOption({
name = "talk_to_ped",
label = "Talk",
icon = "fa-solid fa-comment",
distance = 2.0,
canInteract = function(ctx)
-- Only show for NPCs, not players
return not IsPedAPlayer(ctx.id)
end,
onSelect = function(ctx)
print("Talking to ped: " .. ctx.id)
end
})removePedOption
Removes a previously added ped option.
Export:
exports.lyre_context:removePedOption(optionName)Arguments:
optionName
string or number
Yes
The option name or ID returned by addPedOption.
Returns:
void
Example:
exports.lyre_context:removePedOption("talk_to_ped")addPlayerOption
Adds an interaction option specifically for other players (not NPCs).
Export:
exports.lyre_context:addPlayerOption(options)Arguments:
options
table or table[]
Yes
A single option or an array of options. See Options Properties for details.
Returns:
stringornumber- The option name(s) or auto-generated ID.
Example:
local optionId = exports.lyre_context:addPlayerOption({
name = "give_money",
label = "Give Money",
icon = "fa-solid fa-money-bill",
distance = 3.0,
onSelect = function(ctx)
-- ctx.serverId contains the target player's server ID
TriggerServerEvent("myresource:giveMoney", ctx.serverId, 100)
end
})Note: The context (ctx) for player options includes a serverId field with the target player's server ID.
removePlayerOption
Removes a previously added player option.
Export:
exports.lyre_context:removePlayerOption(optionName)Arguments:
optionName
string or number
Yes
The option name or ID returned by addPlayerOption.
Returns:
void
Example:
exports.lyre_context:removePlayerOption("give_money")addObjectOption
Adds an interaction option to all objects (props) in the game.
Export:
exports.lyre_context:addObjectOption(options)Arguments:
options
table or table[]
Yes
A single option or an array of options. See Options Properties for details.
Returns:
stringornumber- The option name(s) or auto-generated ID.
Example:
local optionId = exports.lyre_context:addObjectOption({
name = "pickup_object",
label = "Pick Up",
icon = "fa-solid fa-hand",
distance = 2.0,
onSelect = function(ctx)
print("Picking up object: " .. ctx.model)
end
})removeObjectOption
Removes a previously added object option.
Export:
exports.lyre_context:removeObjectOption(optionName)Arguments:
optionName
string or number
Yes
The option name or ID returned by addObjectOption.
Returns:
void
Example:
exports.lyre_context:removeObjectOption("pickup_object")addModelOption
Adds an interaction option only to entities with specific model(s).
Export:
exports.lyre_context:addModelOption(models, options)Arguments:
models
string or number or table
Yes
A model name, model hash, or array of model names/hashes.
options
table or table[]
Yes
A single option or an array of options. See Options Properties for details.
Returns:
stringornumber- The option name(s) or auto-generated ID.
Example:
-- Single model by name
local optionId = exports.lyre_context:addModelOption("prop_atm_01", {
name = "use_atm",
label = "Use ATM",
icon = "fa-solid fa-credit-card",
distance = 1.5,
onSelect = function(ctx)
TriggerEvent("banking:openATM")
end
})
-- Multiple models
local optionId = exports.lyre_context:addModelOption(
{ "prop_atm_01", "prop_atm_02", "prop_atm_03" },
{
name = "use_atm",
label = "Use ATM",
icon = "fa-solid fa-credit-card",
onSelect = function(ctx)
TriggerEvent("banking:openATM")
end
}
)
-- Using model hash
local optionId = exports.lyre_context:addModelOption(joaat("adder"), {
name = "special_car",
label = "Special Adder Option",
icon = "fa-solid fa-star",
onSelect = function(ctx)
print("This is an Adder!")
end
})removeModelOption
Removes a previously added model option.
Export:
exports.lyre_context:removeModelOption(model, optionName)Arguments:
model
string or number
Yes
The model name or hash.
optionName
string or number
Yes
The option name or ID returned by addModelOption.
Returns:
void
Example:
exports.lyre_context:removeModelOption("prop_atm_01", "use_atm")addLocalEntityOption
Adds an interaction option to specific entity handle(s). Useful for entities you created and want to add options to.
Export:
exports.lyre_context:addLocalEntityOption(entities, options)Arguments:
entities
number or table
Yes
A single entity handle or an array of entity handles.
options
table or table[]
Yes
A single option or an array of options. See Options Properties for details.
Returns:
stringornumber- The option name(s) or auto-generated ID.
Example:
-- Create a ped and add options to it
local pedModel = joaat("a_m_m_business_01")
RequestModel(pedModel)
while not HasModelLoaded(pedModel) do Wait(10) end
local ped = CreatePed(4, pedModel, 100.0, 200.0, 30.0, 0.0, true, true)
local optionId = exports.lyre_context:addLocalEntityOption(ped, {
name = "talk_to_shopkeeper",
label = "Talk to Shopkeeper",
icon = "fa-solid fa-store",
onSelect = function(ctx)
TriggerEvent("shop:openMenu")
end
})
-- Multiple entities
local optionId = exports.lyre_context:addLocalEntityOption(
{ ped1, ped2, ped3 },
{
name = "guard_interaction",
label = "Talk to Guard",
icon = "fa-solid fa-shield",
onSelect = function(ctx)
print("Talking to guard entity: " .. ctx.id)
end
}
)removeLocalEntityOption
Removes a previously added local entity option.
Export:
exports.lyre_context:removeLocalEntityOption(entity, optionName)Arguments:
entity
number
Yes
The entity handle.
optionName
string or number or nil
No
The option name or ID. If nil, removes all options from the entity.
Returns:
void
Example:
-- Remove specific option
exports.lyre_context:removeLocalEntityOption(ped, "talk_to_shopkeeper")
-- Remove all options from entity
exports.lyre_context:removeLocalEntityOption(ped, nil)Global & Environment Options
addGlobalOption
Adds an option that appears on all interactions (entities and environment).
Export:
exports.lyre_context:addGlobalOption(options)Arguments:
options
table or table[]
Yes
A single option or an array of options. See Options Properties for details.
Returns:
stringornumber- The option name(s) or auto-generated ID.
Example:
local optionId = exports.lyre_context:addGlobalOption({
name = "report_bug",
label = "Report Bug",
icon = "fa-solid fa-bug",
groups = { "admin", "mod" },
onSelect = function(ctx)
print("Bug reported at coords: " .. tostring(ctx.coords))
end
})removeGlobalOption
Removes a previously added global option.
Export:
exports.lyre_context:removeGlobalOption(optionName)Arguments:
optionName
string or number
Yes
The option name or ID returned by addGlobalOption.
Returns:
void
Example:
exports.lyre_context:removeGlobalOption("report_bug")addEnvironmentOption
Adds an option that only appears when targeting the environment (ground, walls, surfaces - not entities).
Export:
exports.lyre_context:addEnvironmentOption(options)Arguments:
options
table or table[]
Yes
A single option or an array of options. See Options Properties for details.
Returns:
stringornumber- The option name(s) or auto-generated ID.
Example:
local optionId = exports.lyre_context:addEnvironmentOption({
name = "place_marker",
label = "Place Marker",
icon = "fa-solid fa-map-pin",
groups = { "admin" },
onSelect = function(ctx)
-- ctx.coords contains the clicked position
-- ctx.normal contains the surface normal
print("Placing marker at: " .. tostring(ctx.coords))
end
})removeEnvironmentOption
Removes a previously added environment option.
Export:
exports.lyre_context:removeEnvironmentOption(optionName)Arguments:
optionName
string or number
Yes
The option name or ID returned by addEnvironmentOption.
Returns:
void
Example:
exports.lyre_context:removeEnvironmentOption("place_marker")Zone Options
addSphereZoneOption
Creates a spherical zone with interaction options.
Export:
exports.lyre_context:addSphereZoneOption(zoneId, coords, radius, options, debug)Arguments:
zoneId
string or nil
No
Unique zone identifier. If nil, an ID is auto-generated.
coords
vector3
Yes
The center coordinates of the sphere.
radius
number
Yes
The radius of the sphere.
options
table or table[]
Yes
A single option or an array of options. See Options Properties for details.
debug
boolean
No
If true, displays a visual marker for the zone. Default: false.
Returns:
stringornumber,stringornumber- Returns two values: the zone ID and the option ID.
Example:
local zoneId, optionId = exports.lyre_context:addSphereZoneOption(
"gas_station_zone",
vector3(265.0, -1261.0, 29.0),
5.0,
{
name = "refuel",
label = "Refuel Vehicle",
icon = "fa-solid fa-gas-pump",
canInteract = function(ctx)
return IsPedInAnyVehicle(PlayerPedId(), false)
end,
onSelect = function(ctx)
TriggerEvent("fuel:refuel")
end
},
false -- debug
)
-- With debug enabled
local zoneId, optionId = exports.lyre_context:addSphereZoneOption(
nil, -- auto-generate ID
vector3(100.0, 200.0, 30.0),
3.0,
{
name = "test_zone",
label = "Test Zone Option",
icon = "fa-solid fa-vial",
onSelect = function(ctx)
print("Clicked in zone!")
end
},
true -- show debug sphere
)addBoxZoneOption
Creates a box-shaped zone with interaction options.
Export:
exports.lyre_context:addBoxZoneOption(zoneId, coords, size, rotation, options, debug)Arguments:
zoneId
string or nil
No
Unique zone identifier. If nil, an ID is auto-generated.
coords
vector3
Yes
The center coordinates of the box.
size
vector3
Yes
The size of the box (length, width, height).
rotation
number
Yes
The rotation of the box in degrees.
options
table or table[]
Yes
A single option or an array of options. See Options Properties for details.
debug
boolean
No
If true, displays a visual marker for the zone. Default: false.
Returns:
stringornumber,stringornumber- Returns two values: the zone ID and the option ID.
Example:
local zoneId, optionId = exports.lyre_context:addBoxZoneOption(
"shop_counter",
vector3(25.0, -1345.0, 29.0),
vector3(2.0, 1.0, 1.5), -- size: 2m long, 1m wide, 1.5m tall
45.0, -- rotated 45 degrees
{
name = "shop_interact",
label = "Browse Shop",
icon = "fa-solid fa-shopping-cart",
onSelect = function(ctx)
TriggerEvent("shop:open")
end
},
true -- debug mode
)addPolyZoneOption
Creates a polygon-shaped zone with interaction options.
Export:
exports.lyre_context:addPolyZoneOption(zoneId, points, thickness, options, debug)Arguments:
zoneId
string or nil
No
Unique zone identifier. If nil, an ID is auto-generated.
points
vector3[]
Yes
An array of vector3 points defining the polygon vertices (minimum 3 points).
thickness
number
Yes
The vertical thickness (height) of the zone.
options
table or table[]
Yes
A single option or an array of options. See Options Properties for details.
debug
boolean
No
If true, displays a visual marker for the zone. Default: false.
Returns:
stringornumber,stringornumber- Returns two values: the zone ID and the option ID.
Example:
local zoneId, optionId = exports.lyre_context:addPolyZoneOption(
"parking_lot",
{
vector3(100.0, 200.0, 30.0),
vector3(120.0, 200.0, 30.0),
vector3(120.0, 220.0, 30.0),
vector3(100.0, 220.0, 30.0),
},
4.0, -- 4 meters thick (height)
{
name = "park_vehicle",
label = "Park Vehicle",
icon = "fa-solid fa-parking",
canInteract = function(ctx)
return IsPedInAnyVehicle(PlayerPedId(), false)
end,
onSelect = function(ctx)
TriggerEvent("garage:park")
end
},
true -- debug mode
)removeZoneOption
Removes a zone or a specific option from a zone.
Export:
exports.lyre_context:removeZoneOption(zoneId, optionName)Arguments:
zoneId
string or number
Yes
The zone identifier.
optionName
string or number or nil
No
The option name to remove. If nil, removes the entire zone.
Returns:
void
Example:
-- Remove entire zone
exports.lyre_context:removeZoneOption("gas_station_zone")
-- Remove specific option from zone (zone remains with other options)
exports.lyre_context:removeZoneOption("multi_option_zone", "specific_option")Menu System
createMenu
Creates a reusable named menu that can be opened from option callbacks.
Export:
exports.lyre_context:createMenu(menuId, title, options)Arguments:
menuId
string or nil
No
Unique menu identifier. If nil, an ID is auto-generated.
title
string
Yes
The title displayed at the top of the menu.
options
table
No
Additional menu options (see below).
Menu Options:
onOpen
function
Callback when menu opens. Receives (data, ...) where ... are args from openMenu.
onClose
function
Callback when menu closes. Receives (data).
data
table
Custom data accessible in menu items and callbacks.
Returns:
string- The menu ID (provided or auto-generated).
Example:
-- Simple menu
local myMenu = exports.lyre_context:createMenu(nil, "Vehicle Options")
-- Menu with callbacks and data
local advancedMenu = exports.lyre_context:createMenu(
"vehicle_menu",
"Vehicle Options",
{
data = { someValue = 123 },
onOpen = function(data, entityCtx)
print("Menu opened! Data:", data.someValue)
print("Entity ID:", entityCtx.id)
end,
onClose = function(data)
print("Menu closed!")
end
}
)addMenuItem
Adds an item to a menu.
Export:
exports.lyre_context:addMenuItem(menuId, item)Arguments:
menuId
string
Yes
The menu identifier.
item
table
Yes
The menu item. See Options Properties for details.
Note: Menu item callbacks receive (ctx, ...) where ctx is the menu context (with data) and ... are the arguments passed to openMenu.
Returns:
void
Example:
local vehicleMenu = exports.lyre_context:createMenu(nil, "Vehicle Options")
exports.lyre_context:addMenuItem(vehicleMenu, {
name = "repair",
label = "Repair Vehicle",
icon = "fa-solid fa-wrench",
groups = { "mechanic" },
onSelect = function(ctx, entityCtx)
-- ctx = menu context with data
-- entityCtx = the entity context passed to openMenu
SetVehicleFixed(entityCtx.id)
end
})
exports.lyre_context:addMenuItem(vehicleMenu, {
name = "go_back",
label = "Go Back",
icon = "fa-solid fa-chevron-left",
onSelect = function()
exports.lyre_context:backToMainMenu()
end
})
-- Now add a vehicle option that opens this menu
exports.lyre_context:addVehicleOption({
name = "open_vehicle_menu",
label = "Vehicle Options",
icon = "fa-solid fa-car",
groups = { "mechanic" },
onSelect = function(ctx)
exports.lyre_context:openMenu(vehicleMenu, ctx)
end
})removeMenuItem
Removes an item from a menu by name.
Export:
exports.lyre_context:removeMenuItem(menuId, itemName)Arguments:
menuId
string
Yes
The menu identifier.
itemName
string
Yes
The item name to remove.
Returns:
void
Example:
exports.lyre_context:removeMenuItem(vehicleMenu, "repair")openMenu
Opens a menu, optionally passing arguments to menu item callbacks.
Export:
exports.lyre_context:openMenu(menuId, ...)Arguments:
menuId
string
Yes
The menu identifier.
...
any
No
Additional arguments passed to onOpen, onSelect, and canInteract callbacks.
Returns:
void
Example:
-- Open menu with entity context
exports.lyre_context:addVehicleOption({
name = "vehicle_options",
label = "Options",
icon = "fa-solid fa-cog",
onSelect = function(ctx)
-- Pass entity context to menu
exports.lyre_context:openMenu("vehicle_menu", ctx)
end
})
-- In menu items, access passed arguments:
exports.lyre_context:addMenuItem("vehicle_menu", {
name = "get_plate",
label = "Get Plate",
icon = "fa-solid fa-id-card",
onSelect = function(menuCtx, entityCtx)
-- menuCtx = { id, title, data }
-- entityCtx = the ctx passed from addVehicleOption's onSelect
print("Plate: " .. GetVehicleNumberPlateText(entityCtx.id))
end
})closeMenu
Closes the currently open menu and the entire context UI.
Export:
exports.lyre_context:closeMenu()Arguments:
None
Returns:
void
Example:
exports.lyre_context:addMenuItem(myMenu, {
name = "close",
label = "Close Menu",
icon = "fa-solid fa-times",
onSelect = function()
exports.lyre_context:closeMenu()
end
})backToMainMenu
Returns to the main entity options without closing the context UI. Useful for submenu navigation.
Export:
exports.lyre_context:backToMainMenu()Arguments:
None
Returns:
void
Example:
exports.lyre_context:addMenuItem(subMenu, {
name = "go_back",
label = "Go Back",
icon = "fa-solid fa-chevron-left",
onSelect = function()
exports.lyre_context:backToMainMenu()
end
})deleteMenu
Deletes a menu entirely.
Export:
exports.lyre_context:deleteMenu(menuId)Arguments:
menuId
string
Yes
The menu identifier.
Returns:
void
Example:
exports.lyre_context:deleteMenu("vehicle_menu")menuExists
Checks if a menu exists.
Export:
exports.lyre_context:menuExists(menuId)Arguments:
menuId
string
Yes
The menu identifier.
Returns:
boolean-trueif the menu exists,falseotherwise.
Example:
if exports.lyre_context:menuExists("vehicle_menu") then
print("Menu exists!")
endupdateMenuData
Updates the custom data associated with a menu.
Export:
exports.lyre_context:updateMenuData(menuId, data)Arguments:
menuId
string
Yes
The menu identifier.
data
table
Yes
The new data table to set.
Returns:
void
Example:
exports.lyre_context:updateMenuData("vehicle_menu", {
lastUsed = GetGameTimer(),
counter = 5
})Utility
disableTargeting
Enables or disables the targeting system entirely.
Export:
exports.lyre_context:disableTargeting(state)Arguments:
state
boolean
Yes
true to disable targeting, false to enable it.
Returns:
void
Example:
-- Disable targeting (e.g., during a cutscene)
exports.lyre_context:disableTargeting(true)
-- Re-enable targeting
exports.lyre_context:disableTargeting(false)Note: When disabling targeting, any open menu will be automatically closed.
Last updated