LogoLogo
SupportServer Hosting
  • Sonoran Radio
    • 🏆Why Choose Sonoran Radio
    • 📱Download the App
  • Other Products
    • 🖥️FiveM Hosting
    • ⌨️Sonoran CAD
    • 📝Sonoran CMS
  • Tutorials
    • Getting Started
      • Register a Community
      • Invite and Manage Users
      • Installing the In-Game Resource
      • Transfer or Delete a Community
    • Usage
      • Dispatch & Admin Panel
        • Using the Dispatch Panel
        • Configure Channels
        • Custom Voice Effects
        • Custom SFX
        • Custom Tone Board
        • Emergency Calls
        • Transmission Logs
        • Default User Settings
        • Multi-Server
      • In-Game Radio
        • Using the In-Game Radio
          • FiveM Keybinds & Commands
        • Customizing Radio Frames
        • Hear Nearby Radio Chatter
        • Radio Scanners
        • In-Game Repeaters
        • Tunnels and Degrade Zones
        • In-Game Speakers
        • Connected Users List
        • Configuring ACE Permissions
        • IP Whitelisting
        • Background Audio Injection
      • Troubleshooting
        • Error Codes
        • Client Debug Mode
        • In-Game Microphone Not Working
        • Browser Microphone Permissions
        • In-Game Volume Too Low
        • Mac Keybinds
        • In-Game Timeouts
    • Integrations
      • AI
      • Sonoran CMS
      • Sonoran CAD Integration
      • Vehicle Radio Display
      • Big Daddy Radio Animations
      • FiveM Inventories
      • FiveM Phone Scripts
      • Developer Documentation
        • Resource API
        • API Endpoints
          • Data Structures
          • Users
            • Get Connected Users
            • Get Connected User
            • Set User Channels
            • Set User Display Name
          • Channels
            • Get Community Channels
          • Community Server
            • Set Server IP
            • Get Server Subscription from IP
            • Set In-Game Speaker Locations
        • Push Events
          • Play Tone
          • User Connected
  • Pricing
    • Pricing FAQ
      • Standalone Pricing
  • Roadmap & Changelog
    • 🗺️Roadmap
    • Changelog
    • Migration Guides
  • Other
    • Contact Us
    • Policy
      • Privacy Policy
      • Refund and Purchase Policy
Powered by GitBook
On this page
  • Push-to-talk
  • Radio Enabled
  • Emergency (911) Calls
  • Signal Quality
  • Panic Button
  • Set Display Name
  • Tower Destruction

Was this helpful?

Edit on GitHub
  1. Tutorials
  2. Integrations
  3. Developer Documentation

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:

-- In your custom script
-- true     = Start
-- false    = End
-- 'toggle' = Toggle
exports['sonoranradio']:setEmergencyCall('toggle')
exports['sonoranradio']:setEmergencyCall('toggle', 'My Custom Name')

The following client events reflect the emergency call status:

-- Event sent from Sonoran Radio
TriggerEvent('SonoranRadio::API:EmergencyCall', enabled)

-- Event listener in a custom script
AddEventHandler('SonoranRadio::API:EmergencyCall', function(enabled)
    print(enabled) -- Boolean (is the call starting (true) or ending (false))
end)
-- Event sent from Sonoran Radio
TriggerEvent('SonoranRadio::API:EmergencyCallDispatcher', dispatcherNames)

-- Event listener in a custom script
AddEventHandler('SonoranRadio::API:EmergencyCallDispatcher', function(dispatcherNames)
    print(dispatcherNames) -- Table with strings for the dispatcher's names
    -- NOTE: does not receive `{}` if emergency call is ended
    -- (above event will receive that)
end)

Signal Quality

You can get the current signal quality with an export

-- In your custom script
exports['sonoranradio']:getSignalQuality() -- number from 0.0 to 1.0

Panic Button

You can listen to or active the panic button with an API event

-- Activate the panic button
TriggerEvent('SonoranRadio::API:PanicButton')

-- Listen to the panic button
AddEventHandler('SonoranRadio::API:PanicButton', function(status)
    print(status) -- Boolean (whether the panic button is active or not)
    -- your code here
end)

Set Display Name

Programatically update a user's radio display name

-- Set your current display name in the radio
exports['sonoranradio']:handleNameChange('my new name')

Tower Destruction

Get notified when a radio tower is destroyed or repaired

-- Event sent from Sonoran Radio (server-side)
TriggerEvent('SonoranRadio::API:TowerDishDestroyed', towerId, tower.DishStatus)

-- Event listener in a custom script
AddEventHandler('SonoranRadio::API:TowerDishDestroyed', function(playerSource, towerId, dishStatus) 
  print(playerSource) -- The player ID that destroyed the dish
  print(towerId) -- Numerical ID of the tower
  print(dishStatus) -- Array of statuses {'alive', 'alive', 'dead', 'alive'}
end)

-- Event sent from Sonoran Radio (server-side)
TriggerEvent('SonoranRadio::API:TowerRepaired', towerId, tower.DishStatus)

-- Event listener in a custom script
AddEventHandler('SonoranRadio::API:TowerRepaired', function(playerSource, towerId, dishStatus) 
  print(playerSource) -- The player ID that repaired the tower
  print(towerId) -- Numerical ID of the tower
  print(dishStatus) -- Array of statuses {'alive', 'alive', 'alive', 'alive'}
                    -- (NOTE: will always contain all 'alive')
end)
PreviousDeveloper DocumentationNextAPI Endpoints

Last updated 1 month ago

Was this helpful?