Server Exports
The call list has a few exports that make it easy to communicate with the call list. See the available server exports below.
Adding a New Call
Export: newCall
Send a new call to the call list.
Aliases
The following export names all perform the same action:
newCallNewCalladdCallAddCall
exports["omik_callist"]:newCall({
src = playerSrc, -- optional, auto-filled from source when possible
identifier = "license:abc123", -- optional alternative to src
from = "Dispatch", -- optional custom sender label
message = "I need help",
service = "police",
coords = { x = 441.2, y = -981.9 } or vector2(441.2, -981.9)
})
Payload fields (v2.2.2+)
| Field | Description | Type | Required |
|---|---|---|---|
| src | Sender source ID. If omitted, it is auto-filled from event/export source when possible | number | No |
| identifier | Identifier used to resolve sender phone (alternative to src) | string | number | No |
| from | Explicit sender label shown in call list (e.g. Dispatch, CAD) | string | No |
| message | Message content | string | Yes |
| service | One of the jobs in Config.jobs | string | Yes |
| coords | Coordinates for the call | {x:number,y:number} or vector2(x, y) | Yes |
Legacy parameters (still supported)
| Parameter | Description | Type | Default |
|---|---|---|---|
| playerSrc | Sender's source ID or 0 for unknown sender | number | 0 |
| message | Message to be sent | string | "" |
| job | One of the jobs in Config.jobs | string | "" |
| coords | Vector with x,y coords | vector2(x, y) |
Example
Server-side payload example (recommended)
local player = source
local ped = GetPlayerPed(player)
local playerCoords = GetEntityCoords(ped)
exports["omik_callist"]:newCall({
src = source,
message = "I need help",
service = "police",
coords = { x = playerCoords.x, y = playerCoords.y } or playerCoords.xy,
})
Using an alias (legacy positional format)
local player = source
local playerCoords = GetEntityCoords(GetPlayerPed(player))
exports["omik_callist"]:addCall(source, "Medical assistance needed", "ambulance", playerCoords.xy)
Deleting Calls
Export: DeleteCallByID
Deletes a specific call by its ID.
local success = exports['omik_callist']:DeleteCallByID(callId)
Parameters:
callId(integer): The unique identifier of the call to delete
Returns:
boolean:trueif the call was successfully deleted,falseotherwise
Example:
local callId = 42
local deleted = exports['omik_callist']:DeleteCallByID(callId)
if deleted then
print("Call deleted successfully")
else
print("Failed to delete call")
end
Export: DeleteCallsByIdentifier
Deletes all calls from a specific user identifier.
local deletedCount = exports['omik_callist']:DeleteCallsByIdentifier(identifier)
Parameters:
identifier(string|integer): The user identifier whose calls should be deleted
Returns:
integer: The number of calls that were deleted
Example:
local identifier = "ABC12345"
local deleted = exports['omik_callist']:DeleteCallsByIdentifier(identifier)
print(string.format("Deleted %d calls from user %s", deleted, identifier))
Export: DeleteCallsByJob
Deletes all calls for a specific job/service.
local deletedCount = exports['omik_callist']:DeleteCallsByJob(jobName)
Parameters:
jobName(string): The job/service name (e.g., "police", "ambulance")
Returns:
integer: The number of calls that were deleted
Example:
-- Clean up all police calls
local deleted = exports['omik_callist']:DeleteCallsByJob("police")
print(string.format("Deleted %d police calls", deleted))
Getting Configuration
Export: Config
Get the configuration settings for the call list
exports["omik_callist"]:Config()
Example
local config = exports["omik_callist"]:Config()
print("Available jobs: " .. json.encode(config.jobs))