Usage
Define menu entries, control the component from client or server code, and connect selections to your own events.
Menu entry interface
Each entry in the menu data array follows the IMenu interface.
namestringThe label displayed for the menu entry.
icon?stringAn optional Font Awesome icon class.
eventName?stringThe event triggered when the entry is selected.
args?anyOptional arguments passed to the selected event.
env?"server" | "client"The environment in which the selected event is triggered.
description?stringOptional supporting text displayed for the menu entry.
Client exports
Open, close or update the menu from client-side Lua code.
exports["avp_click_menu"]:open(atCursor)Opens the menu, optionally at the current cursor position.
atCursor?booleanvoidexports["avp_click_menu"]:close()Closes the active menu.
voidexports["avp_click_menu"]:setData(menuHeader, menuData)Sets the menu header and entries displayed by the component.
menuHeaderstringmenuDataIMenu[]voidServer exports
Control a specific player's menu from server-side Lua code.
exports["avp_click_menu"]:open(source, atCursor)Opens the menu for the specified player.
sourcenumber | stringatCursor?booleanvoidexports["avp_click_menu"]:close(source)Closes the menu for the specified player.
sourcenumber | stringvoidexports["avp_click_menu"]:setData(source, menuHeader, menuData)Sets the menu header and entries for the specified player.
sourcenumber | stringmenuHeaderstringmenuDataIMenu[]voidExamples
Open a menu from the server
Set a player's menu data, open the component and handle the selected server event.
RegisterNetEvent("Ping", function(response)
local source = source
print(source .. " " .. response)
end)
RegisterCommand("sv_test", function(source)
exports["avp_click_menu"]:setData(
source,
"Vehicle (Server)",
{
{
icon = "fa-solid fa-car",
name = "Open door",
eventName = "Ping",
env = "server",
args = "Pong",
description = "Description (server)"
}
}
)
exports["avp_click_menu"]:open(source)
end)
Open a menu from the client
Set the local menu data, open it at the cursor and handle the selected client event.
AddEventHandler("Ping", function(response)
print(response) -- Pong
end)
RegisterCommand("cl_test", function()
exports["avp_click_menu"]:setData(
"Vehicle (Client)",
{
{
icon = "fa-solid fa-car",
name = "Open door",
eventName = "Ping",
env = "client",
args = "Pong",
description = "Description (client)"
}
}
)
exports["avp_click_menu"]:open(true)
end)