Radio
Commands, exports & events
Commands, exports, job channels, death detection and the custom radio prop.
#Commands
Names and keys come from Config.Commands. Keys use RegisterKeyMapping, so each player can rebind them in Settings > Key Bindings > FiveM.
| Command | Default key | Description |
|---|---|---|
/radio | F5 | Opens / closes the radio |
/radioanim | F4 | Radio animation menu |
| (pma-voice) | Left Alt | Talk on the radio (pma-voice push-to-talk) |
The frequency is typed on the keyboard only (for example 101.50), then CONNECT. There are no ACE permissions and no admin commands. With the UI open, Esc only closes the radio.
#Client exports
exports.ghiaccio_radio:isConnected()
exports.ghiaccio_radio:isPoweredOn()
exports.ghiaccio_radio:getFrequency()
exports.ghiaccio_radio:getSignal()
exports.ghiaccio_radio:isTransmitting()
exports.ghiaccio_radio:openRadio() / closeRadio() / openAnimMenu()
exports.ghiaccio_radio:connect(frequency) -- returns ok, errorText
exports.ghiaccio_radio:disconnect()
exports.ghiaccio_radio:getCallsign()
exports.ghiaccio_radio:setCallsign(callsign) -- returns ok, errorText#Server exports
exports.ghiaccio_radio:getFrequency(src)
exports.ghiaccio_radio:isConnected(src)
exports.ghiaccio_radio:disconnect(src, powerOff) -- e.g. when a player is arrested
exports.ghiaccio_radio:connect(src, frequency) -- returns ok, errorCode (checks radio on, item, job, range)
exports.ghiaccio_radio:getMembers(frequency) -- { { id, name, talking } }
exports.ghiaccio_radio:getCallsign(src)
exports.ghiaccio_radio:setCallsign(src, callsign) -- returns ok, errorCode ('' = remove)#Events
To open the radio from another client script (it toggles open / close):
TriggerEvent('ghiaccio_radio:client:use')#Job and grade channels
Defined in config_server.lua:
Config.JobChannels = {
-- single frequency; police and sheriff, any grade
{ id = 'police', label = 'Police', frequency = 1.00, jobs = { police = 0, sheriff = 0 } },
-- grade 3 and above only
{ id = 'police_cmd', label = 'Command', frequency = 1.01, jobs = { police = 3 } },
-- whole range protected (2.00 - 2.09); the "Join" button uses 2.05
{ id = 'ems', label = 'EMS', range = { 2.00, 2.09 }, frequency = 2.05, jobs = { ambulance = 0 } },
-- must be on duty (QBCore/Qbox)
{ id = 'mech', label = 'Mechanics', frequency = 3.00, jobs = { mechanic = 0 }, onDuty = true },
}jobs = { jobName = minGrade }: job and grade are read by the server from the framework (ESXjob.grade, QBCore/Qboxjob.grade.level).- Access is enforced with pma-voice
addChannelCheck: typing the frequency, other scripts or editing the client do not bypass it. - The NUI lists in the job tab only the channels the player can use.
- If job or grade change (framework events plus a re-read every
Config.JobRecheckSeconds) the player is removed from the channel. - With
rangeevery channel of the range is protected (2.00-2.09with 2 decimals is 10 channels; at mostConfig.MaxChannelsPerRule). - Standalone: nobody has a job; plug your own system by returning
{ name, grade }frombridge/server/standalone.lua.
#Death detection
Config.Death.mode decides when the player is "dead": the radio does not transmit and the UI closes (the radio stays connected).
mode | How death is detected |
|---|---|
'auto' (default) | Native check, state bags, framework (ESX esx:onPlayerDeath / esx:onPlayerSpawn; QBCore/Qbox isdead / inlaststand), death and revive events of esx_ambulancejob, qbx_medical, qb-ambulancejob, plus exports of qbx_medical, ars_ambulancejob and wasabi_ambulance, tried only when the resource is running. |
'export' | export = { resource = 'name', name = 'exportName' }: the client export must return true when dead. |
'event' | events = { death = { ... }, revive = { ... } } (client events) plus the native check. |
'statebag' | statebag = { 'isDead', 'dead' }: LocalPlayer.state keys. |
'native' | Only IsEntityDead, IsPedFatallyInjured, IsPlayerDead. |
blockWhenCuffed = true also blocks a cuffed player. With mode 'event' and the standalone bridge, a downed-death script that exposes neither an export nor a state bag is unblocked after 5 seconds.
#Custom radio prop
The companion resource ghiaccio_radio_props streams ghiaccio_radio_a and ghiaccio_radio_b. Start it before ghiaccio_radio. Config.PropModel = 'ghiaccio_radio_b' is the default; if the model is missing the radio falls back to prop_cs_hand_radio with a console warning.
To use your own prop: export the model as .ydr with its .ytd and .ytyp, copy them into ghiaccio_radio/stream/, add data_file 'DLC_ITYP_REQUEST' 'stream/your_prop.ytyp' to fxmanifest.lua, set Config.PropModel = 'your_prop' and tune bone, pos and rot of the presets.