Home › Documentation › Exports · origen_radio
All exports are registered under the resource name origen_radio.
FW_GetPlayer(source, ignoreMetadata) → table | nilReturns a normalised player object for the given server ID. Works for both QBCore and ESX — the returned structure is always QBCore-compatible.
local Player = exports['origen_radio']:FW_GetPlayer(source)
if Player then
print(Player.PlayerData.citizenid)
end| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID |
ignoreMetadata | boolean | If true, metadata is not loaded (faster) |
FW_GetPlayerFromCitizenid(citizenid, ignoreMetadata) → table | nilReturns a normalised player object looked up by citizenid. Supports both online and offline players.
local Player = exports['origen_radio']:FW_GetPlayerFromCitizenid("ABC12345")| Parameter | Type | Description |
|---|---|---|
citizenid | string | The player's citizenid |
ignoreMetadata | boolean | If true, metadata is not loaded |
IsPlayerTalking(player) → booleanReturns true if the given player is currently transmitting on a radio frequency.
local talking = exports['origen_radio']:IsPlayerTalking(source)| Parameter | Type | Description |
|---|---|---|
player | number | Player server ID |
GetPlayersInFrec(frec) → tableReturns 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.
local players = exports['origen_radio']:GetPlayersInFrec("100.5")
for playerId, _ in pairs(players) do
print(playerId, "is on frequency 100.5")
end| Parameter | Type | Description |
|---|---|---|
frec | string | Frequency address string (e.g. "100.5") |
GetPlayersReady(group) → tableReturns a table of player server IDs marked as ready in the given multi-frequency group.
local ready = exports['origen_radio']:GetPlayersReady("police-ABC123")| Parameter | Type | Description |
|---|---|---|
group | string | Full group name including owner suffix (e.g. "police-citizenid") |
GetMultiFrecs(group) → tableReturns the full multi-frequency map for the given group, indexed by frequency name and then by player server ID.
local freqs = exports['origen_radio']:GetMultiFrecs("police-ABC123")
for freqName, players in pairs(freqs) do
print(freqName, players)
end| Parameter | Type | Description |
|---|---|---|
group | string | Full group name (e.g. "police-citizenid") |
OpenRadio()Opens the radio NUI interface. Respects CanOpenRadio() and Config.NeedRadioItem checks.
exports['origen_radio']:OpenRadio()Toggle(value)Enables or disables the radio. If value is nil, the current state is toggled.
exports['origen_radio']:Toggle(true) -- enable
exports['origen_radio']:Toggle(false) -- disable
exports['origen_radio']:Toggle() -- flip| Parameter | Type | Description |
|---|---|---|
value | boolean | nil | true to enable, false to disable, nil to flip |
SetFreq(value)Sets the active simplex frequency. Use 0 to leave the current frequency.
exports['origen_radio']:SetFreq(100.5)
exports['origen_radio']:SetFreq(0) -- leave frequency| Parameter | Type | Description |
|---|---|---|
value | number | Frequency number, or 0 to disconnect |
SetTargets(value)Replaces the current simplex target table with the provided one.
exports['origen_radio']:SetTargets({ [3] = true, [7] = true })AddPlayerTarget(id)Adds a player to the current simplex target list.
exports['origen_radio']:AddPlayerTarget(playerId)RemovePlayerTarget(id)Removes a player from the current simplex target list.
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.
exports['origen_radio']:SetMultiFrec("police-ABC123", "alpha", nil)
exports['origen_radio']:SetMultiFrec("police-ABC123", "none", nil) -- disconnect| Parameter | Type | Description |
|---|---|---|
group | string | Group name |
value | string | Frequency slot name, or "none" to disconnect |
reason | string | nil | Optional reason (e.g. "moved") |
SetMultiFrecTargets(value)Replaces the entire multi-frequency target map.
exports['origen_radio']:SetMultiFrecTargets(newTargets)AddPlayerMultiFrec(id, frec, data)Adds a player to a specific slot in the multi-frequency target map.
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.
exports['origen_radio']:RemovePlayerMultiFrec(playerId, "alpha")
exports['origen_radio']:RemovePlayerMultiFrec(playerId) -- search all slotsMovePlayerMultiFrec(id, group, frec)Moves a player from their current slot to a new one within the same group, syncing with the server.
exports['origen_radio']:MovePlayerMultiFrec(playerId, "police-ABC123", "bravo")SetMuted(id, value)Sets the muted state for a player in the multi-frequency target map.
exports['origen_radio']:SetMuted(playerId, true)SetAnim(value)Sets the active radio animation preset by index (1-based, matching RadioConfig.Anims).
exports['origen_radio']:SetAnim(2) -- use second animation presetToggleClicks(value)Enables or disables the radio click sound on transmission start/end.
exports['origen_radio']:ToggleClicks(false) -- disable click soundsGetMultiFrec() → stringReturns 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.
local slot = exports['origen_radio']:GetMultiFrec()IsTalking() → booleanReturns true if the local player is currently transmitting on any radio frequency.
if exports['origen_radio']:IsTalking() then
-- player is on air
endIsPlayerTalking(source) → booleanClient-side bridge that queries the server and returns whether the given player is currently transmitting. Yields until the server responds.
local talking = exports['origen_radio']:IsPlayerTalking(targetServerId)GetPlayersInFrec(frec) → tableClient-side bridge that queries the server for all players on a given frequency. Yields until the server responds.
local players = exports['origen_radio']:GetPlayersInFrec("100.5")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.
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.
exports['origen_radio']:SetDefaultBind("F5", "origen_radio:myEvent")RemoveKeyBind(key)Removes a keybind by key name.
exports['origen_radio']:RemoveKeyBind("F5")GetKeyBinds() → tableReturns the full keybind map for the local player (key → action).
local binds = exports['origen_radio']:GetKeyBinds()RadioAddKeyBind(_type, key, action)Registers a radio-specific keybind using RegisterKeyMapping. Requires Config.BindSystem = true.
exports['origen_radio']:RadioAddKeyBind("keyboard", "F6", "origen_radio:myEvent")RadioRemoveKeyBind(key)Removes a radio-specific keybind registered via RadioAddKeyBind.
exports['origen_radio']:RadioRemoveKeyBind("F6")