Resource API
Learn more about custom integrations with the in-game resource!
Push-to-talk
When a user presses or releases their PTT key, the following event can be used:
-- Event sent from Sonoran Radio
TriggerEvent('SonoranRadio::API:ToggleTalking', toggle, inVeh)
-- Event listener in a custom script
AddEventHandler('SonoranRadio::API:ToggleTalking', function(toggle, inVeh)
print(toggle) -- Boolean (Are the talking?)
print(inVeh) -- Boolean (Are they in a vehicle)
end)Radio Enabled
You can check if the radio is active (turned on) like so:
-- In your custom script
-- true = active
-- false = inactive
local isActive = exports['sonoranradio']:isRadioActive()Emergency (911) Calls
You can start, end, and toggle an emergency call with a client resource export:
The following client events reflect the emergency call status:
Signal Quality
You can get the current signal quality with an export
Panic Button
You can listen to or active the panic button with an API event
Set Display Name
Programatically update a user's radio display name
Tower Destruction
Get notified when a radio tower is destroyed or repaired
Developer Events
This document lists the server-side events emitted for developer integrations. Payload sketches use Lua table syntax. Unless noted, timestamps are Unix seconds from os.time(). All payloads are sanitized to contain only primitive values and shallow tables.
Common Payload Shapes
Player Payload
Returned by
DeveloperEvents.playerContext.position/headingare included when the underlying call requested coordinates.Dispatcher Payload
Specialised player payload that also embeds the dispatcher’s lb-phone number when available.
Callee Payload
Populated only when the lb-phone API exposes the remote party’s information.
Static Jammer Payload
Handheld Jammer Payload
Dispatcher Redial Lifecycle
SonoranRadio::Developer:DispatcherRedial:RequestedFired when a dispatcher starts a redial request.
Payload:
dispatcher,context
SonoranRadio::Developer:DispatcherRedial:FailedEmitted when a redial cannot be created (missing phone number, lb-phone offline, etc).
Payload:
dispatcher,context,reason,message
SonoranRadio::Developer:DispatcherRedial:StartedIndicates the lb-phone call was created successfully.
Payload:
dispatcher,context,callId,startedAt
SonoranRadio::Developer:DispatcherRedial:AnsweredEmitted when the callee picks up.
Payload:
dispatcher,context,callId,callee?,answeredAt,call?
SonoranRadio::Developer:DispatcherRedial:CancelRequestedFired as soon as the dispatcher manually cancels.
Payload:
dispatcher,context,callId,callee?,requestedAt
SonoranRadio::Developer:DispatcherRedial:EndedAlways emitted when the call fully terminates (hang-up, timeout, cancellation).
Payload:
dispatcher,context,callId,callee?,reason,startedAt,answeredAt?,endedAt,call?
Panic Button
SonoranRadio::Developer:Panic:ActivatedFired when a user enables panic.
Payload:
player– player payload including coordinates/heading when availableactive– alwaystrueupdatedAt– timestamp the server acknowledged the changemetadata?– sanitized metadata sent with the panic request (currently nil)
SonoranRadio::Developer:Panic:ClearedEmitted when panic is cleared by the user or implicitly (logout/cleanup).
Payload:
playeractive– alwaysfalseupdatedAtmetadata?reason?–'playerDropped'when cleared because the player disconnected
Radio State
SonoranRadio::Developer:RadioState:UpdatedFired whenever a client publishes a new radio state snapshot.
Payload:
playerstate– sanitized copy of the radio state table supplied by the client
Jammer Lifecycle
SonoranRadio::Developer:Jammer:SpawnedStatic jammer placed via the build tools.
Payload:
player,jammer(static payload),metadata?
SonoranRadio::Developer:Jammer:MovedStatic/dynamic jammer repositioned.
Payload:
player,jammer,from?(position),to?(position),dynamic(boolean)
SonoranRadio::Developer:Jammer:DeletedJammer removed from the world.
Payload:
player,jammer,dynamic
SonoranRadio::Developer:Jammer:PowerToggledJammer power state flipped (static or dynamic).
Payload:
player,jammer,dynamic
SonoranRadio::Developer:Jammer:HandheldActivatedHandheld jammer equipped by a player.
Payload:
player,jammer(handheld payload),options?
SonoranRadio::Developer:Jammer:HandheldDeactivatedHandheld jammer unequipped or forcibly cleared.
Payload:
player,jammer(handheld payload),reason?('playerDropped'when cleanup triggered)
SonoranRadio::Developer:Jammer:HandheldPowerToggledHandheld jammer power state toggled while equipped.
Payload:
player,jammer
SonoranRadio::Developer:Jammer:HandheldPlacedEquipped handheld placed on the ground as a temporary static jammer.
Payload:
player,handheld(handheld payload prior to placement),groundJammer(static payload)
SonoranRadio::Developer:Jammer:HandheldDroppedHandheld converted to a ground jammer via inventory drop recovery.
Payload:
player,handheld?,groundJammer,dropId?
Last updated
Was this helpful?

