๐ชServer Export
SendAlert
SendAlertSends an alert notification to all players with the specified job type.
Syntax
exports["Var-Alert"]:SendAlert(title, message, duration, code, alertType, coords, jobType, icon)title
string
The title of the alert.
message
string
The message/content of the alert.
duration
number
The duration (in ms) that the alert should be active.
code
string
A code associated with the alert.
alertType
(string, optional)
The type/category of the alert (default: "general").
coords
vector3
The coordinates where the alert originated.
jobType
string
The job that should receive the alert.
icon
string
An icon identifier for the alert.
GetPendingAlertsByJob
GetPendingAlertsByJobRetrieves all pending (not accepted) alerts for a specific job type.
Syntax
local alerts = exports["Var-Alert"]:GetPendingAlertsByJob(jobType)jobType
string
The job type for which to fetch pending alerts.
alerts
table
A list of pending alerts for the specified job.
Example Usage
local pendingPoliceAlerts = exports["Var-Alert"]:GetPendingAlertsByJob("police")
for _, alert in ipairs(pendingPoliceAlerts) do
print(alert.title, alert.message)
endGetAlertsByJob
GetAlertsByJobRetrieves all alerts (both pending and accepted) for a specific job type.
Syntax
local alerts = exports["Var-Alert"]:GetAlertsByJob(jobType)jobType
string
The job type for which to fetch alerts.
alerts
table
A list of all alerts for the specified job.
Example Usage
local policeAlerts = exports["Var-Alert"]:GetAlertsByJob("police")
for _, alert in ipairs(policeAlerts) do
print(alert.title, alert.message, alert.accepted)
endGetAllPendingAlerts
GetAllPendingAlertsRetrieves all pending alerts across all job types.
Syntax
local allPendingAlerts = exports["Var-Alert"]:GetAllPendingAlerts()allPendingAlerts
table
A table containing all pending alerts categorized by job type.
Example Usage
local pendingAlerts = exports["Var-Alert"]:GetAllPendingAlerts()
for job, alerts in pairs(pendingAlerts) do
print("Job: " .. job)
for _, alert in ipairs(alerts) do
print(alert.title, alert.message)
end
endLast updated