Custom menu

if you want to disable the xradio menu you need to switch this value in config.lua

Config.CustomMenu = true

Events that are getting called whenever player trying to open menu

AddEventHandler("xradio:menuOpened", function(type)
    if type == "ground" then
        TriggerEvent("xradio:openRadio") -- will open the radio UI on ground
        TriggerEvent("xradio:radioOnShoulder") -- will equip the radio to shoulder
        TriggerEvent("xradio:deleteRadioOnGround") -- will remove the radio from ground
    end

    if type == "shoulder" then
        TriggerEvent("xradio:openShoulderUi") -- will open the radio UI on shoulder
        TriggerEvent("xradio:hideShoulderRadio") -- will remove the radio from user shoulder
        TriggerEvent("xradio:putRadioBackGround") -- will put radio back to the ground
    end
end)

Real example on MenuAPI from https://github.com/Xogy/MenuAPI

AddEventHandler("xradio:menuOpened", function(type)
    if type == "ground" then
        local menu = Menu:CreateMenu("identifier")

        menu.SetMenuTitle("Radio")

        menu.SetProperties(Config.MenuProperties)

        menu.AddItem(1, _T("open_radio") or "open radio", function()
            menu.Close()
            TriggerEvent("xradio:openRadio")
        end)

        menu.AddItem(2, _T("take_radio") or "pick radio", function()
            menu.Close()
            TriggerEvent("xradio:deleteRadioOnGround")
        end)

        if Config.radioOnShoulder then
            menu.AddItem(3, _T("radio_shoulder") or "Radio on shoulder", function()
                menu.Close()
                TriggerEvent("xradio:radioOnShoulder")
            end)
        end
        menu.Open()
    end

    if type == "shoulder" then
        local menu = Menu:CreateMenu("identifier")

        menu.SetMenuTitle("Radio")

        menu.SetProperties(Config.MenuProperties)

        menu.AddItem(1, _T("shoulder_open_radio") or "open radio", function()
            menu.Close()
            TriggerEvent("xradio:openShoulderUi")
        end)

        menu.AddItem(2, _T("shoulder_hide_radio") or "hide radio", function()
            menu.Close()
            TriggerEvent("xradio:hideShoulderRadio")
        end)

        menu.AddItem(3, _T("put_back_radio") or "Put back radio on ground", function()
            menu.Close()
            TriggerEvent("xradio:putRadioBackGround")
        end)


        menu.Open()
    end
end)

Last updated