Cuchii
2
you need to define the submenu’s items in variables if you want to check which item is selected:
like :
function jsocMainMenu(menu)
--Creates the Main Menu for the Role Select
local roleSelect = _menuPool:AddSubMenu(menu, "Role Select")
menu:AddItem(roleSelect)
--This is the Role Select Sub-Menu (Rifleman, Auto Rifleman, Medic)
local first = NativeUI.CreateItem("Rifleman","")
local second = NativeUI.CreateItem("Auto Rifleman","")
local third = NativeUI.CreateItem("Medic","")
roleSelect:AddItem(rifleman)
roleSelect:AddItem(second)
roleSelect:AddItem(third)
--Where the Action would take place within the SubMenu
roleSelect.OnItemSelect = function(sender, item, index)
if item == first then
TriggerEvent("chatMessage", "Rifleman selected")
elseif item == second then
TriggerEvent("chatMessage", "Auto Rifleman selected")
elseif item == third then
TriggerEvent("chatMessage", "Medic selected")
end
end
end
1 Like