LogoLogo
SupportServer Hosting
  • Sonoran CAD
  • 📱Download The App
    • Steam Browser - Workaround
    • Web Browser - Clear Cache
    • Desktop App - Clear Cache
    • GTA RP Tablet - Clear Cache
    • Steam Browser - Clear Cache
  • Why Choose Sonoran CAD?
    • 🏆Why Choose Sonoran CAD?
  • Other Products
    • 🖥️FiveM Hosting
    • 📝Sonoran CMS
    • 📡Sonoran Radio
  • Tutorials
    • Getting Started
      • Registering Your Account
      • Registering Your Community
      • Inviting Users to Your CAD
      • Granting Account Permissions
      • View Your Limits
      • Community ID and API Keys
      • Troubleshooting
    • Customization
      • Custom Domain & Login Page
      • Customizing Your Layout
      • Community Branding and Settings
      • Creating Custom Record and Report Types
      • Sharing Custom Records
      • Custom Search Types
      • Geographical Settings
      • Penal Codes
      • 10-Codes
      • Addresses and Street Names
      • Unit Status Codes
      • Tone Board
      • Custom Audio Notifications
      • Custom Emails
      • Quick Links
      • Custom Page Colors
      • User Account Restrictions
      • Configuring Multiple Servers
      • Advanced Query Strings
    • Dispatching
      • Creating a Call
      • Self Dispatch
      • Timers
      • Command Line Interface (CLI)
    • Records Management
      • Record Lookups
      • Adding a Record
      • PDF Records
      • Scene Diagram Builder
    • Administration
      • System Logs
      • Remove User Account
      • Deleting or Transferring your CAD
    • Other Features
      • Configurable Hotkeys
      • Voice Commands
      • Volume and Language
  • Integration Capabilities
    • 🗃️Paid Integration Resources
      • Mobile Command Center
      • ATM Robbery
      • In-Vehicle Radar
      • Evidence Camera
      • Power Grid
      • Speed Cameras
      • Shot Spotter
    • 🛠️Integrated Vendors
    • 📺Twitch Bodycam, Bot, & Lighting Integration
    • Database Sync and Merge
      • Database Sync Credentials
      • QB Core Mapping Tutorial
      • Troubleshooting
    • Discord Bot Integration
    • Discord Rich Presence
    • Discord Webhooks
    • TeamSpeak 3 Integration
    • Stream Deck Integration
    • 🎮FiveM
      • FiveM Installation
        • Submodule Configuration
          • Submodule Troubleshooting
          • Submodule Configuration Updates
        • FiveM Submodules
          • Body Camera
          • Call Commands
          • Check API ID
          • Civilian Integration
          • Dispatch Notify
          • Emergency Response Simulator (ERS)
          • Framework Support (ESX/QBCore) and Auto Fines
          • FivePD
          • ForceReg
          • Kick
          • Locations
          • Live Map
          • Lookups
          • Postals
          • Smart Signs
          • Sonoran Radio (sonrad)
          • Station Alert
          • Tablet & Mini-CAD
          • TeamSpeak 3
          • Traffic Stop
          • Unit Status
          • VehReg
          • WraithV2
      • FiveM Development Documentation
        • Client Functions
        • Shared Functions
        • Server Functions
        • Server Events
        • HTTP Request Handling
      • Error Codes
    • 🎮Roblox ER:LC
  • Developer API Documentation
    • 📖API Integration
      • Getting Started
        • Retrieving Your Credentials
        • Integration API ID
        • Account Secret ID
      • Push Events
        • Event Restrictions
        • Record Events
          • Record Added
          • Record Edited
          • Record Removed
        • Unit Events
          • Unit Panic
          • Unit Login
          • Unit Logoff
          • Unit Status Update
          • Unit Group Name Change
          • Unit Group Add
          • Unit Group Remove
        • Dispatch Events
          • New Dispatch
          • Modified Dispatch
          • Closed Dispatch
          • Dispatch Note
          • Attach Unit
          • Detach Unit
          • Toggle Bodycam
        • Event 911
        • Remove 911
        • Sign Updated
        • Tone Played
        • Civilian
          • Character Selected
        • ERS
          • New Callout
        • Station Alert
          • New Station Alert
      • API Endpoints
        • API Restrictions
        • Emergency
          • Identifiers
            • Get Identifiers
            • Modify Identifier
            • Set Identifier
            • Unit Panic
            • Kick Unit
            • Unit Status
            • Get Active Units
            • Update Unit Location
          • Dispatch and Emergency Calls
            • Get Calls
            • New Dispatch
            • Attach Unit
            • Detach Unit
            • Update Call Postal
            • Add Call Note
            • Update Call Primary
            • Close Dispatch
            • New 911 Call
            • Remove 911
          • Custom Blips
            • Get Map Blips
            • Add Blip
            • Modify Blip
            • Remove Blip
          • Street Signs
            • Set Street Sign Config
            • Update Street Sign
          • ERS
            • Set Available Callouts
          • Station Alert
            • Set Stations
        • Civilian
          • Set Character
          • Get Characters
          • New Character
          • Edit Character
          • Remove Character
          • DB Sync: Get Character Links
          • DB Sync: Link Character
        • General
          • Get Servers
          • Set Servers
          • Get Version
          • Set Penal Codes
          • Set API IDs
          • Custom Records
            • API Options for Adding and Modifying Records
            • Get Record Templates
            • New Record
            • Edit Record
            • Remove Record
          • Lookup By Value
          • Lookup Name or Plate
          • Get Account
          • Get Accounts
          • Check API ID
          • Apply Permission Key
          • Modify Account Permissions
          • Kick or Ban User
          • Verify Secret
          • Auth Street Signs
          • Set Postal Config
          • Set Clock Time
          • Send Photo
          • Leave Community
          • Join Community
        • Local Endpoints
          • Smart Lighting
        • Internal
          • FiveM Download
      • API Examples
        • Emergency
          • LUA Examples
            • Dispatch and Emergency Calls
              • New 911 Call
              • Remove 911
              • Add Call Note
              • Set Call Postal
            • Custom Blips
              • Add Blip
              • Add Blips
              • Add Temp Blip
              • Get Map Blips
              • Remove Blip
              • Remove Blip With Subtype
            • General
              • Lookup Name or Plate
          • JavaScript Examples
            • Dispatch and Emergency Calls
              • New 911 Call
              • Remove 911
              • Add Call Note
              • Set Call Postal
            • Custom Blips
              • Add Blip
              • Add Blips
              • Add Temp Blip
              • Get Map Blips
              • Remove Blip
              • Remove Blip With Subtype
            • General
              • Lookup Name or Plate
      • Development Branch
    • 💵Developer Bounties
    • 🌎Translation Support
  • Pricing
    • Pricing FAQ
      • Military and First Responder Discount
      • Expert Installation
      • Accessing the Payment Center
      • Create and Manage a Subscription
      • Request Discord Role
    • View and Compare Plans
  • Roadmap
    • 📋Changelog
  • Other
    • AI QA
    • Contact Us
    • Policy
      • Rocket CAD Closure
      • Terms of Service
      • Privacy Policy
      • Refund and Purchase Policy
      • Discord Bot
    • Archive
      • Fire Siren
Powered by GitBook
On this page
  • CadIsPlayerLinked
  • GetPluginConfig
  • GetUnitByPlayerId
  • GetUnitCache
  • registerEndpoints
  • addBlip
  • addBlips
  • removeBlip
  • modifyBlipd
  • getBlips
  • removeWithSubtype
  • call911
  • addTempBlipData
  • addTempBlipColor
  • remove911
  • addCallNote
  • setCallPostal
  • performLookup

Was this helpful?

Edit on GitHub
  1. Integration Capabilities
  2. FiveM
  3. FiveM Development Documentation

Server Functions

This page will explain all exported functions from the SonoranCAD Core that can be used on the server side

CadIsPlayerLinked

Checks if a specific CAD API ID exists by sending a request to the API and executing a callback with the result.

exports.sonorancad.CadIsPlayerLinked(apiId, callback)

Parameter
Type
Description

apiId

string

The CAD API ID to check. If empty or nil, the function assumes the ID does not exist.

callback

function

A function executed after the check completes. Receives a single parameter: exists (boolean).

This function does not return a value directly. Instead, the result of the API check is passed to the callback function.

-- Example: Checking if a CAD API ID exists
local function onApiIdCheck(exists)
    if exists then
        print("API ID exists!")
    else
        print("API ID does not exist.")
    end
end

exports.sonorancad.CadIsPlayerLinked("123456", onApiIdCheck)  -- Output depends on API response
exports.sonorancad.CadIsPlayerLinked("", onApiIdCheck)        -- Output: "API ID does not exist."

GetPluginConfig

Provides access to a specific plugin's configuration using the plugin name.

exports.sonorancad.GetPluginConfig(submoduleName)
Parameter
Type
Description

submoduleName

string

The name of the submodule whose configuration is to be retrieved.

Type
Description

table or nil

  • A table containing the configuration for the specified plugin.

  • Returns nil if the plugin name is invalid or if no configuration exists.

-- Example: Retrieving a plugin's configuration
local pluginConfig = exports.sonorancad.GetPluginConfig("callcommands")

if pluginConfig then
    print("Plugin Config:", json.encode(pluginConfig))
else
    print("Plugin not found or no configuration available.")
end

GetUnitByPlayerId

Retrieves the unit information associated with a player based on their identifiers.

exports.sonorancad.GetUnitByPlayerId(player)
Parameter
Type
Description

player

PlayerSource

The player ID for whom the associated unit is being retrieved.

Type
Description

table or nil

  • A table representing the unit information for the player if found in UnitCache.

  • nil if no associated unit is found.

-- Example: Getting the unit associated with a player
local unit = GetUnitByPlayerId(1)

if unit then
    print("Unit found:", json.encode(unit))
else
    print("No unit associated with this player.")
end

GetUnitCache

Returns the global UnitCache table containing unit data.

exports.sonorancad.GetUnitCache()

None

Type
Description

table

  • The entire UnitCache table, which stores unit-related data.

  • If UnitCache is empty or uninitialized, an empty table is returned.

-- Example: Retrieving and inspecting the UnitCache
local unitCache = exports.sonorancad.GetUnitCache()

if next(unitCache) then
    print("UnitCache contains data:", json.encode(unitCache))
else
    print("UnitCache is empty or uninitialized.")
end

registerEndpoints

Registers API endpoints for use with the sonorancad resource.

exports.sonorancad.registerEndpoints()

None

This function does not return a value. It registers API endpoints with sonorancad.

-- Example: Registering the endpoints
exports.sonorancad.registerEndpoints()
print("SonoranCAD API endpoints registered.")

addBlip

Adds a new blip to the map using the SonoranCAD integration.

exports.sonorancad.addBlip(coords, colorHex, subType, toolTip, icon, dataTable, cb)
Parameter
Type
Description

coords

vec2 (table)

A table containing x and y coordinates for the blip location.

colorHex

string

The hexadecimal color code (e.g., "#FF0000") for the blip.

subType

string

The subtype of the blip (e.g., police, fire, etc.).

toolTop

string

The tooltip text that appears when hovering over the blip.

icon

string

The icon for the blip (e.g., a specific image or identifier for visual context).

dataTable

table

Additional data associated with the blip, stored in a custom table.

cb

function

(Optional) A callback function executed with the API response.

This function does not return a value directly. The response from the API request is passed to the cb callback function if provided.

-- Example: Adding a new blip to the map
exports.sonorancad.addBlip(
    { x = 123.45, y = 678.90 },
    "#FF0000",
    "police",
    "Police Station",
    "police-icon",
    { info = "Main Headquarters" },
    function(response)
        if response.success then
            print("Blip successfully added!")
        else
            print("Failed to add blip:", response.error)
        end
    end
)

addBlips

Adds multiple blips to the map using the SonoranCAD integration.

exports.sonorancad.addBlips(blips, cb)

Parameter
Type
Description

blips

table

cb

function

(Optional) A callback function executed with the API response.

This function does not return a value directly. The response from the API request is passed to the cb callback function if provided.

-- Example: Adding multiple blips to the map
local blips = {
    {
        blip = {
            id = -1,
            subType = "police",
            coordinates = { x = 123.45, y = 678.90 },
            icon = "police-icon",
            color = "#FF0000",
            tooltip = "Police Station",
            data = { info = "Main Headquarters" }
        }
    },
    {
        blip = {
            id = -1,
            subType = "fire",
            coordinates = { x = 321.65, y = 987.10 },
            icon = "fire-icon",
            color = "#FFA500",
            tooltip = "Fire Department",
            data = { info = "Fire HQ" }
        }
    }
}

exports.sonorancad.addBlips(blips, function(response)
    if response.success then
        print("Blips successfully added!")
    else
        print("Failed to add blips:", response.error)
    end
end)

removeBlip

Removes one or more blips from the map using the SonoranCAD integration.

exports.sonorancad.removeBlip(ids, cb)
Parameter
Type
Description

ids

table

A table containing the IDs of the blips to be removed.

cb

function

(Optional) A callback function executed with the API response.

This function does not return a value directly. The response from the API request is passed to the cb callback function if provided.

-- Example: Removing blips by their IDs
local blipIds = { 101, 102, 103 }

exports.sonorancad.removeBlip(blipIds, function(response)
    if response.success then
        print("Blips successfully removed!")
    else
        print("Failed to remove blips:", response.error)
    end
end)

modifyBlipd

Modifies an existing blip's data on the map using the SonoranCAD integration.

exports.sonorancad.modifyBlipd(blipId, dataTable)
Parameter
Type
Description

blipId

number

The unique ID of the blip to be modified.

dataTable

table

This function does not return a value. The request is sent to the MODIFY_BLIP endpoint.

-- Example: Modifying an existing blip's data
local blipId = 101
local newData = {
    color = "#00FF00",
    tooltip = "Updated Tooltip",
    coordinates = { x = 200.0, y = 300.0 }
}

exports.sonorancad.modifyBlipd(blipId, newData)
print("Blip modification request sent.")

getBlips

Fetches the list of all active blips from the SonoranCAD system.

exports.sonorancad.getBlips(cb)
Parameter
Type
Description

cb

function

(Optional) A callback function executed with the API response containing the blips.

This function does not return a value directly. The response from the API request is passed to the cb callback function if provided.

-- Example: Fetching all active blips
exports.sonorancad.getBlips(function(response)
    if response.success then
        print("Active Blips:", json.encode(response.data))
    else
        print("Failed to fetch blips:", response.error)
    end
end)

removeWithSubtype

Removes all blips of a specific subtype from the map using the SonoranCAD system.

exports.sonorancad.removeWithSubtype(subType, cb)
Parameter
Type
Description

subType

string

The subtype of the blips to be removed (e.g., police, fire, etc.).

cb

function

(Optional) A callback function executed with the API response containing the blips.

This function does not return a value directly. The response from the removeBlip API request is passed to the cb callback function if provided.

-- Example: Removing all police blips
exports.sonorancad.removeWithSubtype("police", function(response)
    if response.success then
        print("Police blips successfully removed!")
    else
        print("Failed to remove blips:", response.error)
    end
end)

call911

The call911 function facilitates the creation of a 911 emergency call within the SonoranCAD system by sending a structured API request.

exports.sonorancad.call911(caller, location, description, postal, plate, cb)
Parameter
Type
Description

caller

string

Name of the individual initiating the call.

location

string

Description of the call's location (e.g., street address).

description

string

Detailed information about the emergency situation.

postal

string

Postal code corresponding to the call's location.

plate

string

(Optional) License plate number associated with the call, if applicable.

cb

function

(Optional) Callback function to handle the API response.

This function does not return a value directly. The response from the API request is passed to the cb callback function, if provided.

-- Example: Initiating a 911 call
exports.sonorancad.call911(
    "Jane Doe",
    "1234 Elm Street",
    "There is a fire in the building.",
    "56789",
    nil,
    function(response)
        if response.success then
            print("911 call successfully placed.")
        else
            print("Failed to place 911 call:", response.error)
        end
    end
)

addTempBlipData

Temporarily modifies a blip's data in the SonoranCAD system and then reverts it back to its original data after a specified duration.

exports.sonorancad.addTempBlipData(blipId, blipData, waitSeconds, returnToData)
Parameter
Type
Description

blipId

number

The unique ID of the blip to modify.

blipData

table

waitSeconds

number

The duration in seconds for which the temporary data will be applied.

returnToData

table

This function does not return a value directly. The data modification happens asynchronously using API requests.

-- Example: Temporarily modifying a blip's color and tooltip
local tempData = {
    color = "#FF0000",
    tooltip = "Temporary Alert"
}

local originalData = {
    color = "#00FF00",
    tooltip = "Original Tooltip"
}

exports.sonorancad.addTempBlipData(101, tempData, 10, originalData)
print("Blip temporarily modified; it will revert in 10 seconds.")

addTempBlipColor

Temporarily changes a blip's color in the SonoranCAD system and reverts it to its original color after a specified duration.

exports.sonorancad.addTempBlipData(blipId, color, waitSeconds, returnToColor)
Parameter
Type
Description

blipId

number

The unique ID of the blip to modify.

color

string

The temporary hexadecimal color code to apply to the blip (e.g., "#FF0000")

waitSeconds

number

The duration in seconds for which the temporary data will be applied.

returnToColor

string

The original hexadecimal color code to revert the blip to after the duration expires

This function does not return a value directly. The color modification happens asynchronously using API requests.

-- Example: Temporarily changing a blip's color to red
local tempColor = "#FF0000"
local originalColor = "#00FF00"

exports.sonorancad.addTempBlipColor(101, tempColor, 10, originalColor)
print("Blip color temporarily changed; it will revert in 10 seconds.")

remove911

Removes an active 911 call from the SonoranCAD system.

exports.sonorancad.remove911(callId)
Parameter
Type
Description

callId

string

The unique ID of the 911 call to be removed.

This function does not return a value. The removal of the 911 call is handled asynchronously through the API request.

-- Example: Removing a 911 call
local callId = "12345"

exports.sonorancad.remove911(callId)
print("Request to remove 911 call sent.")

addCallNote

Adds a note to an existing 911 call in the SonoranCAD system.

exports.sonorancad.addCallNote(callId, note)
Parameter
Type
Description

callId

string

The unique ID of the 911 call to be removed.

note

string

The content of the note to be added, typically describing the caller.

This function does not return a value. The addition of the call note is handled asynchronously through the API request.

-- Example: Adding a note to an existing 911 call
local callId = "12345"
local note = "Caller reported a fire at the intersection of 5th and Main."

exports.sonorancad.addCallNote(callId, note)
print("Request to add note to 911 call sent.")

setCallPostal

Updates the postal code of an existing 911 call in the SonoranCAD system.

exports.sonorancad.setCallPostal(callId, postal)
Parameter
Type
Description

callId

string

The unique ID of the 911 call to be removed.

postal

string

The new postal code to assign to the 911 call.

This function does not return a value. The postal code update is handled asynchronously through the API request.

-- Example: Updating the postal code of an existing 911 call
local callId = "12345"
local postal = "56789"

exports.sonorancad.setCallPostal(callId, postal)
print("Request to update postal code sent.")

performLookup

Performs a lookup in the SonoranCAD system for information associated with a license plate.

exports.sonorancad.performLookup(plate, cb)
Parameter
Type
Description

plate

string

The license plate number to look up in the SonoranCAD system.

cb

function

(Optional) A callback function executed with the API response.

This function does not return a value directly. The response from the API request is passed to the cb callback function if provided.

-- Example: Performing a lookup for a license plate
local plate = "ABC123"

exports.sonorancad.performLookup(plate, function(response)
    if response.success then
        print("Lookup successful:", json.encode(response.data))
    else
        print("Lookup failed:", response.error)
    end
end)

PreviousShared FunctionsNextServer Events

Last updated 5 months ago

Was this helpful?

A table containing multiple blip data objects to be added. (See for blip structure)

A table containing the new data for the blip. See for blip data structure

A table containing the temporary data to apply to the blip. See for blip data structure

A table containing the original data to revert the blip to after the duration expires. See for blip data structure

🎮
addBlip
addBlip
addBlip
addBlip