Alerts
Details
Below, you will find detailed configuration for alerts.
Configuration file
return {
---@type table<string, PredefinedBlip>
predefinedBlips = {
['shooting'] = {
sprite = 110,
color = 1,
scale = 1.2,
time = 6 * (60 * 1000)
},
['vehicle_shooting'] = {
sprite = 110,
color = 1,
scale = 1.2,
time = 6 * (60 * 1000)
},
['fighting'] = {
sprite = 685,
color = 69,
scale = 1.2,
time = 6 * (60 * 1000)
}
},
---@type { enabled: boolean, archiveOlderThan: number }
automaticArchive = {
---@type boolean
enabled = false,
---@type number
archiveOlderThan = 30 * 60, -- 30 minutes
},
---@type { enabled: boolean, deleteOlderThan: number }
automaticDeletion = {
---@type boolean
enabled = false,
---@type number
deleteOlderThan = 30 * 60, -- 30 minutes
},
---@type number
defaultBlipTime = 6 * (60 * 1000),
---@type boolean
slowlyDecreaseBlipOpacity = true,
---@type boolean
enable911Commands = true,
---@type boolean
enable911AnonymousLocations = true,
---@type number
cooldownFor911 = 30, -- seconds
---@type suppressShootingConfig
suppressShooting = {
enabled = true,
delay = 5, -- seconds
radius = 50,
cleanup = 5, -- seconds
},
-- If needed you can suppress specific events that are sending alerts if other scripts are already handling them
---@type { CEventPedJackingMyVehicle: boolean, CEventShockingCarAlarm: boolean, CEventExplosionHeard: boolean, CEventGunShot: boolean, CEventShockingSeenMeleeAction: boolean }
suppressEvents = {
CEventPedJackingMyVehicle = false, -- VehicleJack()
CEventShockingCarAlarm = false, -- VehicleTheft()
CEventExplosionHeard = false, -- Explosion()
CEventGunShot = false, -- Shooting() or VehicleShooting()
CEventShockingSeenMeleeAction = false, -- Fight()
},
---@type ShootingBlacklist
blacklist = {
jobs = {
'police'
},
weapons = {},
zones = {
{ id = "ammunation_1", coords = vector3(13.53, -1097.92, 29.8), size = vector3(14.0, 5.0, 4.0), heading = -20 },
{ id = "ammunation_2", coords = vector3(821.96, -2163.09, 29.62), size = vector3(14.0, 5.0, 4.0), heading = 0 },
}
},
---@type boolean
zonesDebug = false,
---@type table<string, AlertSoundConfig>
sounds = {
['notification'] = {},
['panic'] = {
playForEveryone = true,
forceVolume = true,
volume = 1.0,
spatial = true,
maxDistance = 200.0,
},
['bolo'] = {},
['fastlimit'] = {},
-- Example: spatial sound played from alert coordinates for everyone
-- ['siren'] = {
-- playForEveryone = true,
-- spatial = true,
-- maxDistance = 200.0,
-- duration = 10,
-- },
}
}
Predefined Blips
Predefined blips mean, that you are able to predefine a blip configuration and later to reuse it in string form everywhere. For example, you define blip configuration with shooting key, and later simply use it in alert.
This will simplify your alert creation in general, since if you decide to change blip, you’ll only need to change it only in one place
Payload type
---@class PredefinedBlip
---@field sprite? number
---@field color number
---@field scale number
---@field radius? number
---@field flashes? boolean
---@field time? number Detailed types information
sprite number You can choose a sprite from Fivem Documentation
color number Blip color. Choose from Fivem Documentation
scale number Blip scale. Usually from 0.1 to 1.0
radius number If radius is set, sprite will be ignored and location randomised inside the radius.
flashes boolean Defines if blip flashes.
time number Defines for how long blip will be visible. In miliseconds.
Other definitions
defaultBlipTime number This defines default blip visibility time. In miliseconds.
slowlyDecreaseBlipOpacity boolean If enabled, blip will slowly loose opacity.
enable911Commands boolean Defines if 911 commands are enabled.
enable911AnonymousLocations boolean Defines if the location attached to anonymous 911 alerts is shown. When disabled, anonymous 911 alerts will not expose the caller’s coordinates.
cooldownFor911 number Defines 911 command cooldown before new alert is made. If player has active alert, messages are going to be sent to the same alert.
zonesDebug boolean If enabled, blacklist zones are drawn in-world to help you position and size them.
Automatic archive & deletion
These options allow alerts to be archived or deleted automatically after a period of time.
automaticArchive.enabled boolean Defines if alerts are automatically archived.
automaticArchive.archiveOlderThan number Alerts older than this value (in seconds) will be archived.
automaticDeletion.enabled boolean Defines if alerts are automatically deleted.
automaticDeletion.deleteOlderThan number Alerts older than this value (in seconds) will be deleted.
Shooting suppression
We’ve implemented somewhat complicated system, which will suppress shots and update only shots fired in below defined radius.
Payload type
---@class suppressShootingConfig
---@field enabled boolean
---@field delay number
---@field radius number
---@field cleanup number Detailed types information
enabled boolean Defines if shooting will be suppressed.
delay number Defines shooting delay, which means how long from the first shot, shots will be counted and update on the same alert.
radius number Defines radius, where shoots gonna be suppressed and counted. Radius will be counted from the first shots fired coordinates.
cleanup number Defines a timer, when old logged coordinates will be cleaned up.
Suppress events
Suppress specific game events that trigger alerts, useful when another script already handles them. Set any entry to true to stop that event from generating an alert.
CEventPedJackingMyVehicle boolean Suppresses vehicle jacking alerts. Related handler: VehicleJack().
CEventShockingCarAlarm boolean Suppresses car alarm / theft alerts. Related handler: VehicleTheft().
CEventExplosionHeard boolean Suppresses explosion alerts. Related handler: Explosion().
CEventGunShot boolean Suppresses gunshot alerts. Related handler: Shooting() or VehicleShooting().
CEventShockingSeenMeleeAction boolean Suppresses melee/fighting alerts. Related handler: Fight().
Shooting blacklist
Payload type
---@class ShootingBlacklist
---@field jobs table<string>
---@field weapons table<string>
---@field zones table<{ id: string, coords: vector3, size: vector3, heading: number }> Detailed types information
jobs string[] If job is added to this array, shots will be ignored.
weapons string[] if weapon is added to this array, shots will be ignored from it.
zones ShootingZone[] Areas where shots are ignored (e.g. Ammu-Nation ranges). Each zone has an id (string), coords (vector3), size (vector3) and heading (number).
Sounds
Configure how alert sounds are played. Keys (notification, panic, bolo, fastlimit, …) map to a sound configuration; an empty table {} uses defaults.
Payload type
---@class AlertSoundConfig
---@field playForEveryone? boolean
---@field forceVolume? boolean
---@field volume? number
---@field spatial? boolean
---@field maxDistance? number
---@field duration? number Detailed types information
playForEveryone boolean If enabled, the sound plays for every player rather than only the alert recipient(s).
forceVolume boolean Forces the configured volume instead of the player’s own setting.
volume number Playback volume, from 0.0 to 1.0.
spatial boolean If enabled, the sound is played spatially from the alert coordinates.
maxDistance number Maximum distance (in game units) at which a spatial sound can be heard.
duration number How long the sound plays, in seconds.