# Custom menu

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

```lua
Config.CustomMenu = true
```

Events that are getting called whenever player trying to open menu

```lua
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>

```lua
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)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.rcore.cz/paid-resources/xradio/custommenu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
