Custom · origen_radio
The custom/ folder contains the integration layer between origen_radio and the rest of your server. These files are not escrow-protected and are meant to be edited.
custom/
├── client/
│ └── client.lua ← Framework, inventory, pma-voice and revive integration
└── server/
└── server.lua ← Framework core object and notificationscustom/client/client.lua
GetCoreObject() → table
Returns the framework core object for the active framework.
-- QBCore
local Core = GetCoreObject()
-- ESX
local ESX = GetCoreObject()FW_Notify(text)
Displays a notification to the local player using the active framework's notification system.
FW_Notify("You need a radio item.")| Parameter | Type | Description |
|---|---|---|
text | string | Message to display |
OverrideProximityRange(distance, bool)
Overrides the pma-voice proximity range. Pass nil to clear the override and restore the default.
-- Override to 10 metres
OverrideProximityRange(10.0, true)
-- Clear the override
OverrideProximityRange(nil)| Parameter | Type | Description |
|---|---|---|
distance | number | nil | Desired proximity range in metres, or nil to reset |
bool | boolean | Passed directly to pma-voice:overrideProximityRange |
ToggleVoice(target, value, string)
Calls pma-voice:toggleVoice for the given target.
ToggleVoice(target, true, "radio")PlayerTargets(radioFreqs)
Calls pma-voice:playerTargets with the current list of radio frequency targets.
PlayerTargets(Radio.Targets)IsPlayerDead() → boolean
Returns true if the local player is playing the death animation. Used internally to prevent radio use while dead.
if IsPlayerDead() then return endCanTalk() → boolean
Custom gate that controls whether the player is allowed to transmit. Return false to block transmission under any condition (e.g. cuffed, in a vehicle, etc.).
function CanTalk()
-- Add your logic here
return true
endCanOpenRadio() → boolean
Custom gate that controls whether the player is allowed to open the radio NUI. Return false to prevent opening under any condition.
function CanOpenRadio()
-- Add your logic here
return true
endGetPlayerItems(PlayerData) → table
Returns the player's inventory items for the active inventory resource. This function is used internally to check whether the player carries a radio item when Config.NeedRadioItem is true.
The implementation already handles all supported inventories. Add a new elseif block here if you are using an unsupported inventory.
function GetPlayerItems(PlayerData)
if Config.Inventory == "ox_inventory" then
return exports.ox_inventory:GetPlayerItems()
end
-- ...
return PlayerData.items or {}
endIf Config.CustomReviveEvent is set, custom/client/client.lua automatically registers a listener for that event and re-enables the radio on revive — no additional code is needed.
custom/server/server.lua
GetCoreObject() → table
Returns the framework core object on the server side. Used internally to resolve player data.
local Core = GetCoreObject()FW_Notify(source, text)
Sends a notification to a specific player using the active framework's notification system.
FW_Notify(source, "You have been removed from the frequency.")| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID |
text | string | Message to display |