Server dev / extending
This page is aimed at server developers who want to extend hm_ELSPlus or integrate it into other scripts.
Quick dev workflow
Section titled “Quick dev workflow”- Make changes in
config/*.luaor the vehicle JSON. - Run
els_reload_configson the server (without a full restart). - Respawn the vehicle and test the functions in-game.
- For UI problems, use
/els_editor_fix.
Extending the siren system
Section titled “Extending the siren system”The base configuration is in config/sirens.lua. There you choose between two systems:
WM (WheelMod)
Section titled “WM (WheelMod)”The simplest mode — uses the standard FiveM sirens or WM sound packs.
ELSPlus.SirenSystem = "WM"
ELSPlus.WM = { defaultTones = { [1]="SIREN_ALPHA", [2]="SIREN_BRAVO", [3]="SIREN_CHARLIE" }, soundset = "DLC_WMSIRENS_SOUNDSET", audioBank = "DLC_WMSIRENS\\SIRENPACK_ONE"}defaultTones: the 3 tones assigned to keys 1/2/3 by default.soundset: the GTA soundset (must match the installed mod).audioBank: the audio bank that is loaded (string, not a table).
ServerSided (OISS) — preset system
Section titled “ServerSided (OISS) — preset system”With OISS, sirens are configured via named presets. Each preset bundles soundset, audio bank, available tones and horn.
ELSPlus.SirenSystem = "ServerSided"
-- default preset for new vehicles (must exist in SirenPresets)ELSPlus.DefaultPreset = "LSPD Modern"
ELSPlus.SirenPresets = { ["LSPD Modern"] = { soundset = "oiss_ssa_vehaud_lspd_new_soundset", audioBank = "DLC_SERVERSIDEAUDIO\\OISS_SSA_VEHAUD_LSPD_NEW", tones = { "oiss_ssa_vehaud_lspd_new_siren_adam", "oiss_ssa_vehaud_lspd_new_siren_boy", "oiss_ssa_vehaud_lspd_new_siren_charles", "oiss_ssa_vehaud_lspd_new_siren_david", "oiss_ssa_vehaud_lspd_new_siren_edward", }, horn = "oiss_ssa_vehaud_lspd_new_horn", }, ["BCSO Modern"] = { soundset = "oiss_ssa_vehaud_bcso_new_soundset", audioBank = "DLC_SERVERSIDEAUDIO\\OISS_SSA_VEHAUD_BCSO_NEW", tones = { ... }, horn = "oiss_ssa_vehaud_bcso_new_horn", }, -- more presets: LSSD, SAHP, NOOSE, FIB, RHPD, DPPD, LSIA, -- LSPP, LSFD, LSCOFD, BCFD, SanFire, SAMS, USFS, other -- each in modern and vintage variants}Important:
- Tone names are department-specific! e.g.
oiss_ssa_vehaud_lspd_new_siren_adam(notoiss_ssa_vehaud_siren_adam). - Each preset has:
soundset,audioBank(string),tones(array of all tones),horn. - In the editor the player chooses a preset by name — the matching tones are offered automatically.
ELSPlus.DefaultPresetdetermines which preset new vehicles get.- The OISS resource must be started (source: github.com/fk-1997/Server-Sided-Sounds-and-Sirens).
Backwards compatibility: ELSPlus.ServerSided is generated automatically from the DefaultPreset. Old code that reads ELSPlus.ServerSided.soundset or .defaultTones keeps working.
Overriding per vehicle (JSON)
Section titled “Overriding per vehicle (JSON)”In the vehicle JSON, a different preset/tones can be set per vehicle:
{ "spawnName": "police2", "siren": { "wmTones": [ "oiss_ssa_vehaud_lspd_new_siren_adam", "oiss_ssa_vehaud_lspd_new_siren_boy", "oiss_ssa_vehaud_lspd_new_siren_charles" ], "tonePresets": ["LSPD Modern", "LSPD Modern", "LSPD Modern"], "range": 500 }}wmTones: the 1-3 tone names for the siren keys.tonePresets(OISS only): assigns the preset to each slot (so the editor knows which soundset/bank to load).range: audible range in metres.- Older configs with
siren.soundsetare still supported as well.
NoFlash / not being flashed
Section titled “NoFlash / not being flashed”The setting is per vehicle in the JSON config:
{ "spawnName": "police2", "noFlash": true}Behaviour:
noFlash: trueon its own is not enough.- Protection applies when the emergency lights are on and
noFlashis active.
Exports for speed camera scripts
Section titled “Exports for speed camera scripts”hm_ELSPlus provides exports you can use directly in speed camera or radar scripts:
IsNoFlashActive(vehicle)->trueif the emergency lights are on and NoFlash is set.IsBlueLightActive(vehicle)->trueif the primary light is on.IsElsVehicle(vehicle)->trueif the vehicle has an ELS/attachment config.HasNoFlashConfig(vehicle)->trueif the config hasnoFlashset.
Minimal example:
local function shouldFlash(vehicle) if GetResourceState("hm_ELSPlus") ~= "started" then return true end if exports["hm_ELSPlus"]:IsNoFlashActive(vehicle) then return false end return trueendState bags (direct query)
Section titled “State bags (direct query)”For diagnostics or your own logic you can read state bags directly:
local state = Entity(vehicle).statelocal primary = state["els_primary"] == truelocal rearWarning = state["els_rearWarning"] == truelocal siren1 = state["els_siren_1"] == trueNote: state bags show the live state, but not the full vehicle configuration.
Useful commands
Section titled “Useful commands”Chat (client)
Section titled “Chat (client)”/els_config- open the editor/els_editor_fix- reset the UI/els_env_debug- env light debug
Server console
Section titled “Server console”els_reload_configs- reload vehicle configsels_debug_layouts- debug layouts
Commonly forgotten
Section titled “Commonly forgotten”- Set write permissions on
config/correctly (see File permissions, otherwise nothing is saved). - With ServerSided sirens, check that the audio resource is really started.
- After structural changes, always test with several vehicle types (ELS + attachment).