OrigenNetwork
Docs

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.

text
custom/
├── client/
│   └── client.lua   ← Framework, inventory, pma-voice and revive integration
└── server/
    └── server.lua   ← Framework core object and notifications

custom/client/client.lua

GetCoreObject()table

Returns the framework core object for the active framework.

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

lua
FW_Notify("You need a radio item.")
ParameterTypeDescription
textstringMessage to display

OverrideProximityRange(distance, bool)

Overrides the pma-voice proximity range. Pass nil to clear the override and restore the default.

lua
-- Override to 10 metres
OverrideProximityRange(10.0, true)
 
-- Clear the override
OverrideProximityRange(nil)
ParameterTypeDescription
distancenumber | nilDesired proximity range in metres, or nil to reset
boolbooleanPassed directly to pma-voice:overrideProximityRange

ToggleVoice(target, value, string)

Calls pma-voice:toggleVoice for the given target.

lua
ToggleVoice(target, true, "radio")

PlayerTargets(radioFreqs)

Calls pma-voice:playerTargets with the current list of radio frequency targets.

lua
PlayerTargets(Radio.Targets)

IsPlayerDead()boolean

Returns true if the local player is playing the death animation. Used internally to prevent radio use while dead.

lua
if IsPlayerDead() then return end

CanTalk()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.).

lua
function CanTalk()
    -- Add your logic here
    return true
end

CanOpenRadio()boolean

Custom gate that controls whether the player is allowed to open the radio NUI. Return false to prevent opening under any condition.

lua
function CanOpenRadio()
    -- Add your logic here
    return true
end

GetPlayerItems(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.

lua
function GetPlayerItems(PlayerData)
    if Config.Inventory == "ox_inventory" then
        return exports.ox_inventory:GetPlayerItems()
    end
    -- ...
    return PlayerData.items or {}
end

If 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.

lua
local Core = GetCoreObject()

FW_Notify(source, text)

Sends a notification to a specific player using the active framework's notification system.

lua
FW_Notify(source, "You have been removed from the frequency.")
ParameterTypeDescription
sourcenumberPlayer server ID
textstringMessage to display