> For the complete documentation index, see [llms.txt](https://codestudio5m.gitbook.io/codestudio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codestudio5m.gitbook.io/codestudio/our-scripts/advanced-radio/setup.md).

# Setup

## Detailed Config is provided with the script with detailed information:

<mark style="background-color:red;">**Supports Every Server: QBCore, ESX, Standalone**</mark>

<figure><img src="/files/hrKKZTfrX6ESdq0bTUQ1" alt=""><figcaption></figcaption></figure>

## Events

* <pre class="language-lua" data-title="Open Radio UI"><code class="lang-lua">TriggerEvent('cs:advradio:openRadio', 1) --To Use Model 2 put 2 insted of 1
  </code></pre>
* <pre class="language-lua" data-title="Close Radio UI"><code class="lang-lua">TriggerEvent('cs:advradio:closeUI')
  </code></pre>
* <pre class="language-lua" data-title="Open Radio Scanner UI"><code class="lang-lua">TriggerEvent('cs:advradio:openScanner')
  </code></pre>
* <pre class="language-lua" data-title="Remove Player From Radio"><code class="lang-lua">TriggerServerEvent('cs:advradio:forceLeave', 1) -- You can provide a player ID to remove a specific player from radio
  </code></pre>
* <pre class="language-lua" data-title="Set Dead Status [true,false]"><code class="lang-lua">TriggerEvent('cs:advradio:isDead', true) --true/false Update Death Status from youreath script
  </code></pre>
* <pre class="language-lua" data-title="Emergency Alert"><code class="lang-lua"><strong>TriggerServerEvent('cs:advradio:alertAll', channel) -- alert in specific channel
  </strong></code></pre>

## Exports

* <pre class="language-lua" data-title="Check Current Channel"><code class="lang-lua">exports["cs_walkietalkie"]:isInRadio() --Fetched Player's Channel
  </code></pre>
* <pre class="language-lua" data-title="Join Radio By Export " data-full-width="false"><code class="lang-lua">-- This export can be used on both the server and client sides --

  -- return: 'connected', 'restrict', 'password'
  exports["cs_walkietalkie"]:joinRadio(channel)  --Client

  -- return: 'connected', 'restrict', 'password'
  exports["cs_walkietalkie"]:joinRadio(playerID, channel)  --Server
  </code></pre>

## Usages

You can customize this script to support every voice system: **pma-voice**, **toko-voip**, **saltychat**

\*It supports **Mumble VOIP** as well, but since pma-voice is the latest version of Mumble, we recommend using that. However, if you still prefer Mumble, you can continue using this script, and it will work with Mumble as well

```lua
RegisterNetEvent('cs:advradio:connect', function (channel, connect)
    if connect then
        -- PMA Voice --
        exports["pma-voice"]:setRadioChannel(channel)
        exports["pma-voice"]:setVoiceProperty("radioEnabled", true)

        -- Toko Voip --
        -- exports.tokovoip_script:addPlayerToRadio(channel)
        -- exports.tokovoip_script:setPlayerData(GetPlayerName(PlayerId()), "radio:channel", channel, true)

        -- Salty Chat --
        -- exports.saltychat:SetRadioChannel(tostring(channel), true)
    else
        -- PMA Voice --
        exports["pma-voice"]:setRadioChannel(0)
        exports["pma-voice"]:setVoiceProperty("radioEnabled", false)

        -- Toko Voip --
        -- exports.tokovoip_script:removePlayerFromRadio(exports.tokovoip_script:getPlayerData(GetPlayerName(PlayerId()), "radio:channel"))
        -- exports.tokovoip_script:setPlayerData(GetPlayerName(PlayerId()), "radio:channel", "nil", true)

        -- Salty Chat --
        -- exports.saltychat:SetRadioChannel("", true)
    end
end)

RegisterNUICallback('setVolume', function(curVol, cb)
    -- PMA Voice --
    exports['pma-voice']:setRadioVolume(tonumber(curVol))

    -- Toko Voip --
    -- exports.tokovoip_script:setRadioVolume(tonumber(curVol))

    -- Salty Chat --
    -- exports.saltychat:SetRadioVolume(tonumber(curVol))
end)
```

### *<mark style="background-color:red;">**Additional detailed guidance can be found in the config itself. If you need further assistance, please feel free to contact us on Discord.**</mark>*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://codestudio5m.gitbook.io/codestudio/our-scripts/advanced-radio/setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
