API Documentation
Menu
API Documentation
Menu
vorp menu is a library that allows you to create menus in game with a rdr2 style.
GetMenuData
on top of your client scripts add this to get the menu data setters and getters
return
table
The menu data
local Menu = exports.vorp_menu:GetMenuData()
CloseAll
Close all menus
return
void
The menu data
MenuData.CloseAll()
Menu Elements
Menu elements are the elements that will be displayed in the menu
value
string
requiredThe value of the tab element
label
string
requiredThe label of the tab element
desc
string
requiredThe description of the tab element
local MenuElements = {
{
label = "name",
value = "value",
desc = "description"
}
}
Functions
update elements ,add ,remove ,get elements runtime
this function will add a new element to the current menu elements by order
label
string
requiredThe label of the element
value
string
requiredThe value of the element
desc
string
requiredThe description of the element
menu.addNewElement({
label = "label",
value = "open",
desc = "description"
})
refresh menu to show new element
menu.refresh()
Menu Example
function OpenMenu()
Menu.CloseAll()
MenuElements = {
{
label = "name",
value = "value",
desc = "description"
}
{
label = "name",
value = 0,
desc = "description",
type = "slider",
min = 0,
max = 10,
hop = 1
}
{
label = "name",
value = "value",
desc = "description",
itemHeight = "4vh"
}
{
label = "name",
value = "value",
desc = "description",
any = any --(optional)
table = { --(optional)
string = "string",
number = 111,
table = table,
}
}
}
Menu.Open("default",GetCurrentResourceName(),"OpenMenu", -- unique namespace will allow the menu to open where you left off
{
title = "menu title",
subtext = "menu sub text",
align = "align", -- top-right , top-center , top-left
elements = MenuElements, -- elements needed
lastmenu = "function name", -- if you wish to go back to the previous menu , or remove (optional)
itemHeight = "4vh", -- set all elements to this height if they are not definded in the element (optional)
},
function(data, menu)
-- to go back to lastmenu if any
if (data.current == "backup") then --(optional)
return _G[data.trigger](any,any) -- or the function of the last menu
end
-- get any of the params you definded in the elements
if data.current.value == "value" then
return
end
if data.current.info == "param" then
return menu.close()
end
end,function(data,menu)
-- if theres no previous menu close menu on backspace press
menu.close()
end)
end