OrigenNetwork
Docs

Exports · origen_radio

All exports are registered under the resource name origen_radio.


Server-side exports

FW_GetPlayer(source, ignoreMetadata)table | nil

Returns a normalised player object for the given server ID. Works for both QBCore and ESX — the returned structure is always QBCore-compatible.

lua
local Player = exports['origen_radio']:FW_GetPlayer(source)
if Player then
    print(Player.PlayerData.citizenid)
end
ParameterTypeDescription
sourcenumberPlayer server ID
ignoreMetadatabooleanIf true, metadata is not loaded (faster)

FW_GetPlayerFromCitizenid(citizenid, ignoreMetadata)table | nil

Returns a normalised player object looked up by citizenid. Supports both online and offline players.

lua
local Player = exports['origen_radio']:FW_GetPlayerFromCitizenid("ABC12345")
ParameterTypeDescription
citizenidstringThe player's citizenid
ignoreMetadatabooleanIf true, metadata is not loaded

IsPlayerTalking(player)boolean

Returns true if the given player is currently transmitting on a radio frequency.

lua
local talking = exports['origen_radio']:IsPlayerTalking(source)
ParameterTypeDescription
playernumberPlayer server ID

GetPlayersInFrec(frec)table

Returns a table of all player server IDs currently on the given frequency. Returns an empty table if the frequency is "entrada" or has no active players.

lua
local players = exports['origen_radio']:GetPlayersInFrec("100.5")
for playerId, _ in pairs(players) do
    print(playerId, "is on frequency 100.5")
end
ParameterTypeDescription
frecstringFrequency address string (e.g. "100.5")

GetPlayersReady(group)table

Returns a table of player server IDs marked as ready in the given multi-frequency group.

lua
local ready = exports['origen_radio']:GetPlayersReady("police-ABC123")
ParameterTypeDescription
groupstringFull group name including owner suffix (e.g. "police-citizenid")

GetMultiFrecs(group)table

Returns the full multi-frequency map for the given group, indexed by frequency name and then by player server ID.

lua
local freqs = exports['origen_radio']:GetMultiFrecs("police-ABC123")
for freqName, players in pairs(freqs) do
    print(freqName, players)
end
ParameterTypeDescription
groupstringFull group name (e.g. "police-citizenid")

Client-side exports

OpenRadio()

Opens the radio NUI interface. Respects CanOpenRadio() and Config.NeedRadioItem checks.

lua
exports['origen_radio']:OpenRadio()

Toggle(value)

Enables or disables the radio. If value is nil, the current state is toggled.

lua
exports['origen_radio']:Toggle(true)   -- enable
exports['origen_radio']:Toggle(false)  -- disable
exports['origen_radio']:Toggle()       -- flip
ParameterTypeDescription
valueboolean | niltrue to enable, false to disable, nil to flip

SetFreq(value)

Sets the active simplex frequency. Use 0 to leave the current frequency.

lua
exports['origen_radio']:SetFreq(100.5)
exports['origen_radio']:SetFreq(0)  -- leave frequency
ParameterTypeDescription
valuenumberFrequency number, or 0 to disconnect

SetTargets(value)

Replaces the current simplex target table with the provided one.

lua
exports['origen_radio']:SetTargets({ [3] = true, [7] = true })

AddPlayerTarget(id)

Adds a player to the current simplex target list.

lua
exports['origen_radio']:AddPlayerTarget(playerId)

RemovePlayerTarget(id)

Removes a player from the current simplex target list.

lua
exports['origen_radio']:RemovePlayerTarget(playerId)

SetMultiFrec(group, value, reason)

Sets the active multi-frequency slot within a group. Use "none" for value to disconnect from the current slot.

lua
exports['origen_radio']:SetMultiFrec("police-ABC123", "alpha", nil)
exports['origen_radio']:SetMultiFrec("police-ABC123", "none", nil) -- disconnect
ParameterTypeDescription
groupstringGroup name
valuestringFrequency slot name, or "none" to disconnect
reasonstring | nilOptional reason (e.g. "moved")

SetMultiFrecTargets(value)

Replaces the entire multi-frequency target map.

lua
exports['origen_radio']:SetMultiFrecTargets(newTargets)

AddPlayerMultiFrec(id, frec, data)

Adds a player to a specific slot in the multi-frequency target map.

lua
exports['origen_radio']:AddPlayerMultiFrec(playerId, "alpha", { name = "John Doe", muted = false })

RemovePlayerMultiFrec(id, frec)

Removes a player from a specific multi-frequency slot, or from any slot if frec is nil.

lua
exports['origen_radio']:RemovePlayerMultiFrec(playerId, "alpha")
exports['origen_radio']:RemovePlayerMultiFrec(playerId) -- search all slots

MovePlayerMultiFrec(id, group, frec)

Moves a player from their current slot to a new one within the same group, syncing with the server.

lua
exports['origen_radio']:MovePlayerMultiFrec(playerId, "police-ABC123", "bravo")

SetMuted(id, value)

Sets the muted state for a player in the multi-frequency target map.

lua
exports['origen_radio']:SetMuted(playerId, true)

SetAnim(value)

Sets the active radio animation preset by index (1-based, matching RadioConfig.Anims).

lua
exports['origen_radio']:SetAnim(2) -- use second animation preset

ToggleClicks(value)

Enables or disables the radio click sound on transmission start/end.

lua
exports['origen_radio']:ToggleClicks(false) -- disable click sounds

GetMultiFrec()string

Returns the name of the frequency slot the local player is currently on within their multi-frequency group. Returns "none" if not connected to any slot.

lua
local slot = exports['origen_radio']:GetMultiFrec()

IsTalking()boolean

Returns true if the local player is currently transmitting on any radio frequency.

lua
if exports['origen_radio']:IsTalking() then
    -- player is on air
end

IsPlayerTalking(source)boolean

Client-side bridge that queries the server and returns whether the given player is currently transmitting. Yields until the server responds.

lua
local talking = exports['origen_radio']:IsPlayerTalking(targetServerId)

GetPlayersInFrec(frec)table

Client-side bridge that queries the server for all players on a given frequency. Yields until the server responds.

lua
local players = exports['origen_radio']:GetPlayersInFrec("100.5")

Keybind exports (client-side)

These exports are only active when Config.BindSystem is set to true.

AddKeyBind(key, action, name)

Registers a keybind that triggers a FiveM event when pressed.

lua
exports['origen_radio']:AddKeyBind("F5", "origen_radio:myEvent", "My Radio Bind")

SetDefaultBind(key, action)

Registers a keybind only if the action is not already bound to any key.

lua
exports['origen_radio']:SetDefaultBind("F5", "origen_radio:myEvent")

RemoveKeyBind(key)

Removes a keybind by key name.

lua
exports['origen_radio']:RemoveKeyBind("F5")

GetKeyBinds()table

Returns the full keybind map for the local player (key → action).

lua
local binds = exports['origen_radio']:GetKeyBinds()

RadioAddKeyBind(_type, key, action)

Registers a radio-specific keybind using RegisterKeyMapping. Requires Config.BindSystem = true.

lua
exports['origen_radio']:RadioAddKeyBind("keyboard", "F6", "origen_radio:myEvent")

RadioRemoveKeyBind(key)

Removes a radio-specific keybind registered via RadioAddKeyBind.

lua
exports['origen_radio']:RadioRemoveKeyBind("F6")